home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 1999 #5 / 1999 CD 5 (black).iso / Delphi3 / install / data.z / COMMCTRL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-04  |  122.8 KB  |  4,044 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Run-time Library                         }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1996,97 Borland International     }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit Commctrl;
  12.  
  13. {$WEAKPACKAGEUNIT}
  14.  
  15. interface
  16.  
  17. uses Messages, Windows, ActiveX;
  18.  
  19. { Interface for the Windows Property Sheet Pages }
  20.  
  21. const
  22.   MAXPROPPAGES = 100;
  23.  
  24.   PSP_DEFAULT             = $0000;
  25.   PSP_DLGINDIRECT         = $0001;
  26.   PSP_USEHICON            = $0002;
  27.   PSP_USEICONID           = $0004;
  28.   PSP_USETITLE            = $0008;
  29.  
  30.   PSP_HASHELP             = $0020;
  31.   PSP_USEREFPARENT        = $0040;
  32.   PSP_USECALLBACK         = $0080;
  33.  
  34.   PSPCB_RELEASE           = 1;
  35.   PSPCB_CREATE            = 2;
  36.  
  37.   PSH_DEFAULT             = $0000;
  38.   PSH_PROPTITLE           = $0001;
  39.   PSH_USEHICON            = $0002;
  40.   PSH_USEICONID           = $0004;
  41.   PSH_PROPSHEETPAGE       = $0008;
  42.   PSH_MULTILINETABS       = $0010;
  43.   PSH_WIZARD              = $0020;
  44.   PSH_USEPSTARTPAGE       = $0040;
  45.   PSH_NOAPPLYNOW          = $0080;
  46.   PSH_USECALLBACK         = $0100;
  47.   PSH_HASHELP             = $0200;
  48.   PSH_MODELESS            = $0400;
  49.  
  50.   PSCB_INITIALIZED  = 1;
  51.  
  52.   PSN_FIRST               = -200;
  53.   PSN_LAST                = -299;
  54.  
  55.   PSN_SETACTIVE           = PSN_FIRST - 0;
  56.   PSN_KILLACTIVE          = PSN_FIRST - 1;
  57.   PSN_APPLY               = PSN_FIRST - 2;
  58.   PSN_RESET               = PSN_FIRST - 3;
  59.   PSN_HELP                = PSN_FIRST - 5;
  60.   PSN_WIZBACK             = PSN_FIRST - 6;
  61.   PSN_WIZNEXT             = PSN_FIRST - 7;
  62.   PSN_WIZFINISH           = PSN_FIRST - 8;
  63.   PSN_QUERYCANCEL         = PSN_FIRST - 9;
  64.  
  65.   PSNRET_NOERROR              = 0;
  66.   PSNRET_INVALID              = 1;
  67.   PSNRET_INVALID_NOCHANGEPAGE = 2;
  68.  
  69.   PSM_SETCURSEL           = WM_USER + 101;
  70.   PSM_REMOVEPAGE          = WM_USER + 102;
  71.   PSM_ADDPAGE             = WM_USER + 103;
  72.   PSM_CHANGED             = WM_USER + 104;
  73.   PSM_RESTARTWINDOWS      = WM_USER + 105;
  74.   PSM_REBOOTSYSTEM        = WM_USER + 106;
  75.   PSM_CANCELTOCLOSE       = WM_USER + 107;
  76.   PSM_QUERYSIBLINGS       = WM_USER + 108;
  77.   PSM_UNCHANGED           = WM_USER + 109;
  78.   PSM_APPLY               = WM_USER + 110;
  79.   PSM_SETTITLE            = WM_USER + 111;
  80.   PSM_SETTITLEW           = WM_USER + 120;
  81.   PSM_SETWIZBUTTONS       = WM_USER + 112;
  82.   PSM_PRESSBUTTON         = WM_USER + 113;
  83.   PSM_SETCURSELID         = WM_USER + 114;
  84.   PSM_SETFINISHTEXT       = WM_USER + 115;
  85.   PSM_SETFINISHTEXTW      = WM_USER + 121;
  86.   PSM_GETTABCONTROL       = WM_USER + 116;
  87.   PSM_ISDIALOGMESSAGE     = WM_USER + 117;
  88.  
  89.   PSWIZB_BACK             = $00000001;
  90.   PSWIZB_NEXT             = $00000002;
  91.   PSWIZB_FINISH           = $00000004;
  92.   PSWIZB_DISABLEDFINISH   = $00000008;
  93.  
  94.   PSBTN_BACK              = 0;
  95.   PSBTN_NEXT              = 1;
  96.   PSBTN_FINISH            = 2;
  97.   PSBTN_OK                = 3;
  98.   PSBTN_APPLYNOW          = 4;
  99.   PSBTN_CANCEL            = 5;
  100.   PSBTN_HELP              = 6;
  101.   PSBTN_MAX               = 6;
  102.  
  103.   ID_PSRESTARTWINDOWS     = 2;
  104.   ID_PSREBOOTSYSTEM       = ID_PSRESTARTWINDOWS or 1;
  105.  
  106.   WIZ_CXDLG               = 276;
  107.   WIZ_CYDLG               = 140;
  108.  
  109.   WIZ_CXBMP               = 80;
  110.  
  111.   WIZ_BODYX               = 92;
  112.   WIZ_BODYCX              = 184;
  113.  
  114.   PROP_SM_CXDLG           = 212;
  115.   PROP_SM_CYDLG           = 188;
  116.  
  117.   PROP_MED_CXDLG          = 227;
  118.   PROP_MED_CYDLG          = 215;
  119.  
  120.   PROP_LG_CXDLG           = 252;
  121.   PROP_LG_CYDLG           = 218;
  122.  
  123. type
  124.   HPropSheetPage = Pointer;
  125.  
  126.   PPropSheetPageA = ^TPropSheetPageA;
  127.   PPropSheetPageW = ^TPropSheetPageW;
  128.   PPropSheetPage = PPropSheetPageA;
  129.  
  130.   TFNPSPCallbackA = function(Wnd: HWnd; Msg: Integer;
  131.     PPSP: PPropSheetPageA): Integer stdcall;
  132.   TFNPSPCallbackW = function(Wnd: HWnd; Msg: Integer;
  133.     PPSP: PPropSheetPageW): Integer stdcall;
  134.   TFNPSPCallback = TFNPSPCallbackA;
  135.  
  136.   TPropSheetPageA = record
  137.     dwSize: Longint;
  138.     dwFlags: Longint;
  139.     hInstance: THandle;
  140.     case Integer of
  141.       0: (
  142.     pszTemplate: PAnsiChar);
  143.       1: (
  144.     pResource: Pointer;
  145.     case Integer of
  146.       0: (
  147.         hIcon: THandle);
  148.       1: (
  149.         pszIcon: PAnsiChar;
  150.         pszTitle: PAnsiChar;
  151.         pfnDlgProc: Pointer;
  152.         lParam: Longint;
  153.         pfnCallback: TFNPSPCallbackA;
  154.         pcRefParent: PInteger));
  155.   end;
  156.   TPropSheetPageW = record
  157.     dwSize: Longint;
  158.     dwFlags: Longint;
  159.     hInstance: THandle;
  160.     case Integer of
  161.       0: (
  162.     pszTemplate: PWideChar);
  163.       1: (
  164.     pResource: Pointer;
  165.     case Integer of
  166.       0: (
  167.         hIcon: THandle);
  168.       1: (
  169.         pszIcon: PWideChar;
  170.         pszTitle: PWideChar;
  171.         pfnDlgProc: Pointer;
  172.         lParam: Longint;
  173.         pfnCallback: TFNPSPCallbackW;
  174.         pcRefParent: PInteger));
  175.   end;
  176.   TPropSheetPage = TPropSheetPageA;
  177.  
  178.   TFNPropSheetCallback = function(Wnd: HWnd; Msg: Integer;
  179.     LParam: Integer): Integer stdcall;
  180.  
  181.   PPropSheetHeaderA = ^TPropSheetHeaderA;
  182.   PPropSheetHeaderW = ^TPropSheetHeaderW;
  183.   PPropSheetHeader = PPropSheetHeaderA;
  184.   TPropSheetHeaderA = record
  185.     dwSize: Longint;
  186.     dwFlags: Longint;
  187.     hwndParent: HWnd;
  188.     hInstance: THandle;
  189.     case Integer of
  190.       0: (
  191.     hIcon: THandle);
  192.       1: (
  193.     pszIcon: PAnsiChar;
  194.     pszCaption: PAnsiChar;
  195.     nPages: Integer;
  196.     case Integer of
  197.       0: (
  198.         nStartPage: Integer);
  199.       1: (
  200.         pStartPage: PAnsiChar;
  201.         case Integer of
  202.           0: (
  203.         ppsp: PPropSheetPageA);
  204.           1: (
  205.         phpage: Pointer;
  206.         pfnCallback: TFNPropSheetCallback)));
  207.   end;
  208.   TPropSheetHeaderW = record
  209.     dwSize: Longint;
  210.     dwFlags: Longint;
  211.     hwndParent: HWnd;
  212.     hInstance: THandle;
  213.     case Integer of
  214.       0: (
  215.     hIcon: THandle);
  216.       1: (
  217.     pszIcon: PWideChar;
  218.     pszCaption: PWideChar;
  219.     nPages: Integer;
  220.     case Integer of
  221.       0: (
  222.         nStartPage: Integer);
  223.       1: (
  224.         pStartPage: PWideChar;
  225.         case Integer of
  226.           0: (
  227.         ppsp: PPropSheetPageW);
  228.           1: (
  229.         phpage: Pointer;
  230.         pfnCallback: TFNPropSheetCallback)));
  231.   end;
  232.   TPropSheetHeader = TPropSheetHeaderA;
  233.  
  234.   TFNAddPropSheetPage = function(hPSP: HPropSheetPage;
  235.     lParam: Longint): BOOL stdcall;
  236.  
  237. function CreatePropertySheetPageA(var PSP: TPropSheetPageA): HPropSheetPage; stdcall;
  238. function CreatePropertySheetPageW(var PSP: TPropSheetPageW): HPropSheetPage; stdcall;
  239. function CreatePropertySheetPage(var PSP: TPropSheetPage): HPropSheetPage; stdcall;
  240. function DestroyPropertySheetPage(hPSP: HPropSheetPage): BOOL; stdcall;
  241. function PropertySheetA(var PSH: TPropSheetHeaderA): Integer; stdcall;
  242. function PropertySheetW(var PSH: TPropSheetHeaderW): Integer; stdcall;
  243. function PropertySheet(var PSH: TPropSheetHeader): Integer; stdcall;
  244.  
  245. type
  246.   PInitCommonControlsEx = ^TInitCommonControlsEx;
  247.   TInitCommonControlsEx = packed record
  248.     dwSize: DWORD;             // size of this structure
  249.     dwICC: DWORD;              // flags indicating which classes to be initialized
  250.   end;
  251.  
  252. const
  253.   ICC_LISTVIEW_CLASSES = $00000001; // listview, header
  254.   ICC_TREEVIEW_CLASSES = $00000002; // treeview, tooltips
  255.   ICC_BAR_CLASSES      = $00000004; // toolbar, statusbar, trackbar, tooltips
  256.   ICC_TAB_CLASSES      = $00000008; // tab, tooltips
  257.   ICC_UPDOWN_CLASS     = $00000010; // updown
  258.   ICC_PROGRESS_CLASS   = $00000020; // progress
  259.   ICC_HOTKEY_CLASS     = $00000040; // hotkey
  260.   ICC_ANIMATE_CLASS    = $00000080; // animate
  261.   ICC_WIN95_CLASSES    = $000000FF;
  262.   ICC_DATE_CLASSES     = $00000100; // month picker, date picker, time picker, updown
  263.   ICC_USEREX_CLASSES   = $00000200; // comboex
  264.   ICC_COOL_CLASSES     = $00000400; // rebar (coolbar) control
  265.  
  266. procedure InitCommonControls; stdcall;
  267. function InitCommonControlsEx(var ICC: TInitCommonControlsEx): Bool; { Re-defined below }
  268.  
  269. const
  270.   IMAGE_BITMAP = 0;
  271.  
  272. const
  273.   ODT_HEADER              = 100;
  274.   ODT_TAB                 = 101;
  275.   ODT_LISTVIEW            = 102;
  276.  
  277.  
  278. { ====== Ranges for control message IDs ======================= }
  279.  
  280. const
  281.   LVM_FIRST               = $1000;      { ListView messages }
  282.   TV_FIRST                = $1100;      { TreeView messages }
  283.   HDM_FIRST               = $1200;      { Header messages }
  284.  
  285.  
  286.  
  287. { ====== WM_NOTIFY codes (NMHDR.code values) ================== }
  288.  
  289. const
  290.   NM_FIRST                 = 0-  0;       { generic to all controls }
  291.   NM_LAST                  = 0- 99;
  292.  
  293.   LVN_FIRST                = 0-100;       { listview }
  294.   LVN_LAST                 = 0-199;
  295.  
  296.   HDN_FIRST                = 0-300;       { header }
  297.   HDN_LAST                 = 0-399;
  298.  
  299.   TVN_FIRST                = 0-400;       { treeview }
  300.   TVN_LAST                 = 0-499;
  301.  
  302.   TTN_FIRST                = 0-520;       { tooltips }
  303.   TTN_LAST                 = 0-549;
  304.  
  305.   TCN_FIRST                = 0-550;       { tab control }
  306.   TCN_LAST                 = 0-580;
  307.  
  308. { Shell reserved           (0-580) -  (0-589) }
  309.  
  310.   CDN_FIRST                = 0-601;       { common dialog (new) }
  311.   CDN_LAST                 = 0-699;
  312.  
  313.   TBN_FIRST                = 0-700;       { toolbar }
  314.   TBN_LAST                 = 0-720;
  315.  
  316.   UDN_FIRST                = 0-721;       { updown }
  317.   UDN_LAST                 = 0-740;
  318.  
  319.   MCN_FIRST                = 0-750;       { monthcal }
  320.   MCN_LAST                 = 0-759;
  321.  
  322.   DTN_FIRST                = 0-760;       { datetimepick }
  323.   DTN_LAST                 = 0-799;
  324.  
  325.   CBEN_FIRST               = 0-800;       { combo box ex }
  326.   CBEN_LAST                = 0-830;
  327.  
  328.   RBN_FIRST                = 0-831;       { coolbar }
  329.   RBN_LAST                 = 0-859;
  330.  
  331.   MSGF_COMMCTRL_BEGINDRAG     = $4200;
  332.   MSGF_COMMCTRL_SIZEHEADER    = $4201;
  333.   MSGF_COMMCTRL_DRAGSELECT    = $4202;
  334.   MSGF_COMMCTRL_TOOLBARCUST   = $4203;
  335.  
  336.  
  337. { ====== Generic WM_NOTIFY notification codes ================= }
  338.  
  339. const
  340.   NM_OUTOFMEMORY           = NM_FIRST-1;
  341.   NM_CLICK                 = NM_FIRST-2;
  342.   NM_DBLCLK                = NM_FIRST-3;
  343.   NM_RETURN                = NM_FIRST-4;
  344.   NM_RCLICK                = NM_FIRST-5;
  345.   NM_RDBLCLK               = NM_FIRST-6;
  346.   NM_SETFOCUS              = NM_FIRST-7;
  347.   NM_KILLFOCUS             = NM_FIRST-8;
  348.  
  349.  
  350. { ====== IMAGE LIST =========================================== }
  351.  
  352.  
  353. const
  354.   CLR_NONE                = $FFFFFFFF;
  355.   CLR_DEFAULT             = $FF000000;
  356.  
  357. type
  358.   HImageList = THandle;
  359.  
  360. const
  361.   ILC_MASK                = $0001;
  362.   ILC_COLOR               = $00FE;
  363.   ILC_COLORDDB            = $00FE;
  364.   ILC_COLOR4              = $0004;
  365.   ILC_COLOR8              = $0008;
  366.   ILC_COLOR16             = $0010;
  367.   ILC_COLOR24             = $0018;
  368.   ILC_COLOR32             = $0020;
  369.   ILC_PALETTE             = $0800;
  370.  
  371. function ImageList_Create(CX, CY: Integer; Flags: UINT;
  372.   Initial, Grow: Integer): HImageList; stdcall;
  373. function ImageList_Destroy(ImageList: HImageList): Bool; stdcall;
  374. function ImageList_GetImageCount(ImageList: HImageList): Integer; stdcall;
  375. function ImageList_Add(ImageList: HImageList; Image, Mask: HBitmap): Integer; stdcall;
  376. function ImageList_ReplaceIcon(ImageList: HImageList; Index: Integer;
  377.   Icon: HIcon): Integer; stdcall;
  378. function ImageList_SetBkColor(ImageList: HImageList; ClrBk: TColorRef): TColorRef; stdcall;
  379. function ImageList_GetBkColor(ImageList: HImageList): TColorRef; stdcall;
  380. function ImageList_SetOverlayImage(ImageList: HImageList; Image: Integer;
  381.   Overlay: Integer): Bool; stdcall;
  382.  
  383. function ImageList_AddIcon(ImageList: HImageList; Icon: HIcon): Integer;
  384.  
  385. const
  386.   ILD_NORMAL              = $0000;
  387.   ILD_TRANSPARENT         = $0001;
  388.   ILD_MASK                = $0010;
  389.   ILD_IMAGE               = $0020;
  390.   ILD_BLEND25             = $0002;
  391.   ILD_BLEND50             = $0004;
  392.   ILD_OVERLAYMASK         = $0F00;
  393.  
  394. function IndexToOverlayMask(Index: Integer): Integer;
  395.  
  396. const
  397.   ILD_SELECTED            = ILD_BLEND50;
  398.   ILD_FOCUS               = ILD_BLEND25;
  399.   ILD_BLEND               = ILD_BLEND50;
  400.   CLR_HILIGHT             = CLR_DEFAULT;
  401.  
  402. function ImageList_Draw(ImageList: HImageList; Index: Integer;
  403.   Dest: HDC; X, Y: Integer; Style: UINT): Bool; stdcall;
  404.  
  405. function ImageList_Replace(ImageList: HImageList; Index: Integer;
  406.   Image, Mask: HBitmap): Bool; stdcall;
  407. function ImageList_AddMasked(ImageList: HImageList; Image: HBitmap;
  408.   Mask: TColorRef): Integer; stdcall;
  409. function ImageList_DrawEx(ImageList: HImageList; Index: Integer;
  410.   Dest: HDC; X, Y, DX, DY: Integer; Bk, Fg: TColorRef; Style: Cardinal): Bool; stdcall;
  411. function ImageList_Remove(ImageList: HImageList; Index: Integer): Bool; stdcall;
  412. function ImageList_GetIcon(ImageList: HImageList; Index: Integer;
  413.   Flags: Cardinal): HIcon; stdcall;
  414. function ImageList_LoadImageA(Instance: THandle; Bmp: PAnsiChar; CX, Grow: Integer;
  415.   Mask: TColorRef; pType, Flags: Cardinal): HImageList; stdcall;
  416. function ImageList_LoadImageW(Instance: THandle; Bmp: PWideChar; CX, Grow: Integer;
  417.   Mask: TColorRef; pType, Flags: Cardinal): HImageList; stdcall;
  418. function ImageList_LoadImage(Instance: THandle; Bmp: PChar; CX, Grow: Integer;
  419.   Mask: TColorRef; pType, Flags: Cardinal): HImageList; stdcall;
  420. function ImageList_BeginDrag(ImageList: HImageList; Track: Integer;
  421.   XHotSpot, YHotSpot: Integer): Bool; stdcall;
  422. function ImageList_EndDrag: Bool; stdcall;
  423. function ImageList_DragEnter(LockWnd: HWnd; X, Y: Integer): Bool; stdcall;
  424. function ImageList_DragLeave(LockWnd: HWnd): Bool; stdcall;
  425. function ImageList_DragMove(X, Y: Integer): Bool; stdcall;
  426. function ImageList_SetDragCursorImage(ImageList: HImageList; Drag: Integer;
  427.   XHotSpot, YHotSpot: Integer): Bool; stdcall;
  428. function ImageList_DragShowNolock(Show: Bool): Bool; stdcall;
  429. function ImageList_GetDragImage(Point, HotSpot: PPoint): HImageList; stdcall;
  430.  
  431. { macros }
  432. procedure ImageList_RemoveAll(ImageList: HImageList);
  433. function ImageList_ExtractIcon(Instance: THandle; ImageList: HImageList;
  434.   Image: Integer): HIcon;
  435. function ImageList_LoadBitmap(Instance: THandle; Bmp: PChar;
  436.   CX, Grow: Integer; MasK: TColorRef): HImageList;
  437.  
  438. function ImageList_Read(Stream: IStream): HImageList; stdcall;
  439. function ImageList_Write(ImageList: HImageList; Stream: IStream): BOOL; stdcall;
  440.  
  441. type
  442.   PImageInfo = ^TImageInfo;
  443.   TImageInfo = packed record
  444.     hbmImage: HBitmap;
  445.     hbmMask: HBitmap;
  446.     Unused1: Integer;
  447.     Unused2: Integer;
  448.     rcImage: TRect;
  449.   end;
  450.  
  451. function ImageList_GetIconSize(ImageList: HImageList; var CX, CY: Integer): Bool; stdcall;
  452. function ImageList_SetIconSize(ImageList: HImageList; CX, CY: Integer): Bool; stdcall;
  453. function ImageList_GetImageInfo(ImageList: HImageList; Index: Integer;
  454.   var ImageInfo: TImageInfo): Bool; stdcall;
  455. function ImageList_Merge(ImageList1: HImageList; Index1: Integer;
  456.   ImageList2: HImageList; Index2: Integer; DX, DY: Integer): Bool; stdcall;
  457.  
  458.  
  459. { ====== HEADER CONTROL ========================== }
  460.  
  461. const
  462.   WC_HEADER = 'SysHeader32';
  463.  
  464.   HDS_HORZ                = $00000000;
  465.   HDS_BUTTONS             = $00000002;
  466.   HDS_HOTTRACK            = $00000004;
  467.   HDS_HIDDEN              = $00000008;
  468.   HDS_DRAGDROP            = $00000040;
  469.   HDS_FULLDRAG            = $00000080;
  470.  
  471. type
  472.   PHDItemA = ^THDItemA;
  473.   PHDItemW = ^THDItemW;
  474.   PHDItem = PHDItemA;
  475.   THDItemA = packed record
  476.     Mask: Cardinal;
  477.     cxy: Integer;
  478.     pszText: PAnsiChar;
  479.     hbm: HBITMAP;
  480.     cchTextMax: Integer;
  481.     fmt: Integer;
  482.     lParam: LPARAM;
  483.   end;
  484.   THDItemW = packed record
  485.     Mask: Cardinal;
  486.     cxy: Integer;
  487.     pszText: PWideChar;
  488.     hbm: HBITMAP;
  489.     cchTextMax: Integer;
  490.     fmt: Integer;
  491.     lParam: LPARAM;
  492.   end;
  493.   THDItem = THDItemA;
  494.  
  495. const
  496.   HDI_WIDTH               = $0001;
  497.   HDI_HEIGHT              = HDI_WIDTH;
  498.   HDI_TEXT                = $0002;
  499.   HDI_FORMAT              = $0004;
  500.   HDI_LPARAM              = $0008;
  501.   HDI_BITMAP              = $0010;
  502.  
  503.   HDF_LEFT                = 0;
  504.   HDF_RIGHT               = 1;
  505.   HDF_CENTER              = 2;
  506.   HDF_JUSTIFYMASK         = $0003;
  507.   HDF_RTLREADING          = 4; 
  508.  
  509.   HDF_OWNERDRAW           = $8000;
  510.   HDF_STRING              = $4000;
  511.   HDF_BITMAP              = $2000;
  512.  
  513.   HDM_GETITEMCOUNT        = HDM_FIRST + 0;
  514.  
  515. function Header_GetItemCount(Header: HWnd): Integer;
  516.  
  517. const
  518.   HDM_INSERTITEMW          = HDM_FIRST + 10;
  519.   HDM_INSERTITEMA          = HDM_FIRST + 1;
  520.   HDM_INSERTITEM           = HDM_INSERTITEMA;
  521.  
  522. function Header_InsertItem(Header: HWnd; Index: Integer;
  523.   const Item: THDItem): Integer;
  524.  
  525. const
  526.   HDM_DELETEITEM          = HDM_FIRST + 2;
  527.  
  528. function Header_DeleteItem(Header: HWnd; Index: Integer): Bool;
  529.  
  530. const
  531.   HDM_GETITEMW             = HDM_FIRST + 11;
  532.   HDM_GETITEMA             = HDM_FIRST + 3;
  533.   HDM_GETITEM              = HDM_GETITEMA;
  534.  
  535. function Header_GetItem(Header: HWnd; Index: Integer;
  536.   var Item: THDItem): Bool;
  537.  
  538. const
  539.   HDM_SETITEMA            = HDM_FIRST + 4;
  540.   HDM_SETITEMW            = HDM_FIRST + 12;
  541.   HDM_SETITEM             = HDM_SETITEMA;
  542.  
  543. function Header_SetItem(Header: HWnd; Index: Integer; const Item: THDItem): Bool;
  544.  
  545. type
  546.   PHDLayout = ^THDLayout;
  547.   THDLayout = packed record
  548.     Rect: ^TRect;
  549.     WindowPos: PWindowPos;
  550.   end;
  551.  
  552. const
  553.   HDM_LAYOUT              = HDM_FIRST + 5;
  554.  
  555. function Header_Layout(Header: HWnd; Layout: PHDLayout): Bool;
  556.  
  557. const
  558.   HHT_NOWHERE             = $0001;
  559.   HHT_ONHEADER            = $0002;
  560.   HHT_ONDIVIDER           = $0004;
  561.   HHT_ONDIVOPEN           = $0008;
  562.   HHT_ABOVE               = $0100;
  563.   HHT_BELOW               = $0200;
  564.   HHT_TORIGHT             = $0400;
  565.   HHT_TOLEFT              = $0800;
  566.  
  567. type
  568.   PHDHitTestInfo = ^THDHitTestInfo;
  569.   THDHitTestInfo = packed record
  570.     Point: TPoint;
  571.     Flags: Cardinal;
  572.     Item: Integer;
  573.   end;
  574.  
  575. const
  576.   HDM_HITTEST             = HDM_FIRST + 6;
  577.  
  578. const
  579.   HDN_ITEMCHANGINGA        = HDN_FIRST-0;
  580.   HDN_ITEMCHANGEDA         = HDN_FIRST-1;
  581.   HDN_ITEMCLICKA           = HDN_FIRST-2;
  582.   HDN_ITEMDBLCLICKA        = HDN_FIRST-3;
  583.   HDN_DIVIDERDBLCLICKA     = HDN_FIRST-5;
  584.   HDN_BEGINTRACKA          = HDN_FIRST-6;
  585.   HDN_ENDTRACKA            = HDN_FIRST-7;
  586.   HDN_TRACKA               = HDN_FIRST-8;
  587.  
  588.   HDN_ITEMCHANGINGW        = HDN_FIRST-20;
  589.   HDN_ITEMCHANGEDW         = HDN_FIRST-21;
  590.   HDN_ITEMCLICKW           = HDN_FIRST-22;
  591.   HDN_ITEMDBLCLICKW        = HDN_FIRST-23;
  592.   HDN_DIVIDERDBLCLICKW     = HDN_FIRST-25;
  593.   HDN_BEGINTRACKW          = HDN_FIRST-26;
  594.   HDN_ENDTRACKW            = HDN_FIRST-27;
  595.   HDN_TRACKW               = HDN_FIRST-28;
  596.  
  597.   HDN_ITEMCHANGING        = HDN_ITEMCHANGINGA;
  598.   HDN_ITEMCHANGED         = HDN_ITEMCHANGEDA;
  599.   HDN_ITEMCLICK           = HDN_ITEMCLICKA;
  600.   HDN_ITEMDBLCLICK        = HDN_ITEMDBLCLICKA;
  601.   HDN_DIVIDERDBLCLICK     = HDN_DIVIDERDBLCLICKA;
  602.   HDN_BEGINTRACK          = HDN_BEGINTRACKA;
  603.   HDN_ENDTRACK            = HDN_ENDTRACKA;
  604.   HDN_TRACK               = HDN_TRACKA;
  605.  
  606. type
  607.   PHDNotifyA = ^THDNotifyA;
  608.   PHDNotifyW = ^THDNotifyW;
  609.   PHDNotify = PHDNotifyA;
  610.   THDNotifyA = packed record
  611.     Hdr: TNMHDR;
  612.     Item: Integer;
  613.     Button: Integer;
  614.     PItem: PHDItemA;
  615.   end;
  616.   THDNotifyW = packed record
  617.     Hdr: TNMHDR;
  618.     Item: Integer;
  619.     Button: Integer;
  620.     PItem: PHDItemW;
  621.   end;
  622.   THDNotify = THDNotifyA;
  623.  
  624.  
  625. { ====== TOOLBAR CONTROL =================== }
  626.  
  627. const
  628.   TOOLBARCLASSNAME = 'ToolbarWindow32';
  629.  
  630. type
  631.   PTBButton = ^TTBButton;
  632.   TTBButton = packed record
  633.     iBitmap: Integer;
  634.     idCommand: Integer;
  635.     fsState: Byte;
  636.     fsStyle: Byte;
  637.     bReserved: array[1..2] of Byte;
  638.     dwData: Longint;
  639.     iString: Integer;
  640.   end;
  641.  
  642.   PColorMap = ^TColorMap;
  643.   TColorMap = packed record
  644.     cFrom: TColorRef;
  645.     cTo: TColorRef;
  646.   end;
  647.  
  648. function CreateToolBarEx(Wnd: HWnd; ws: Longint; ID: UINT;
  649.   Bitmaps: Integer; BMInst: THandle; BMID: Cardinal; Buttons: PTBButton;
  650.   NumButtons: Integer; dxButton, dyButton: Integer;
  651.   dxBitmap, dyBitmap: Integer; StructSize: UINT): HWnd; stdcall;
  652.  
  653. function CreateMappedBitmap(Instance: THandle; Bitmap: Integer;
  654.   Flags: UINT; ColorMap: PColorMap; NumMaps: Integer): HBitmap; stdcall;
  655.  
  656. const
  657.  
  658.   CMB_MASKED              = $02;
  659.  
  660.   TBSTATE_CHECKED         = $01;
  661.   TBSTATE_PRESSED         = $02;
  662.   TBSTATE_ENABLED         = $04;
  663.   TBSTATE_HIDDEN          = $08;
  664.   TBSTATE_INDETERMINATE   = $10;
  665.   TBSTATE_WRAP            = $20;
  666.   TBSTATE_ELLIPSES        = $40;
  667.  
  668.   TBSTYLE_BUTTON          = $00;
  669.   TBSTYLE_SEP             = $01;
  670.   TBSTYLE_CHECK           = $02;
  671.   TBSTYLE_GROUP           = $04;
  672.   TBSTYLE_CHECKGROUP      = TBSTYLE_GROUP or TBSTYLE_CHECK;
  673.   TBSTYLE_DROPDOWN        = $08;
  674.  
  675.   TBSTYLE_TOOLTIPS        = $0100;
  676.   TBSTYLE_WRAPABLE        = $0200;
  677.   TBSTYLE_ALTDRAG         = $0400;
  678.   TBSTYLE_FLAT            = $0800;
  679.   TBSTYLE_LIST            = $1000;
  680.   TBSTYLE_CUSTOMERASE     = $2000;
  681.  
  682.   TB_ENABLEBUTTON         = WM_USER + 1;
  683.   TB_CHECKBUTTON          = WM_USER + 2;
  684.   TB_PRESSBUTTON          = WM_USER + 3;
  685.   TB_HIDEBUTTON           = WM_USER + 4;
  686.   TB_INDETERMINATE        = WM_USER + 5;
  687.   TB_ISBUTTONENABLED      = WM_USER + 9;
  688.   TB_ISBUTTONCHECKED      = WM_USER + 10;
  689.   TB_ISBUTTONPRESSED      = WM_USER + 11;
  690.   TB_ISBUTTONHIDDEN       = WM_USER + 12;
  691.   TB_ISBUTTONINDETERMINATE = WM_USER + 13;
  692.   TB_SETSTATE             = WM_USER + 17;
  693.   TB_GETSTATE             = WM_USER + 18;
  694.   TB_ADDBITMAP            = WM_USER + 19;
  695.  
  696. type
  697.   PTBAddBitmap = ^TTBAddBitmap;
  698.   TTBAddBitmap = packed record
  699.     hInst: THandle;
  700.     nID: UINT;
  701.   end;
  702.  
  703. const
  704.   HINST_COMMCTRL = THandle(-1);
  705.  
  706.   IDB_STD_SMALL_COLOR     = 0;
  707.   IDB_STD_LARGE_COLOR     = 1;
  708.   IDB_VIEW_SMALL_COLOR    = 4;
  709.   IDB_VIEW_LARGE_COLOR    = 5;
  710.   IDB_HIST_SMALL_COLOR    = 8;
  711.   IDB_HIST_LARGE_COLOR    = 9;
  712.  
  713. { icon indexes for standard bitmap }
  714.   STD_CUT                 = 0;
  715.   STD_COPY                = 1;
  716.   STD_PASTE               = 2;
  717.   STD_UNDO                = 3;
  718.   STD_REDOW               = 4;
  719.   STD_DELETE              = 5;
  720.   STD_FILENEW             = 6;
  721.   STD_FILEOPEN            = 7;
  722.   STD_FILESAVE            = 8;
  723.   STD_PRINTPRE            = 9;
  724.   STD_PROPERTIES          = 10;
  725.   STD_HELP                = 11;
  726.   STD_FIND                = 12;
  727.   STD_REPLACE             = 13;
  728.   STD_PRINT               = 14;
  729.  
  730. { icon indexes for standard view bitmap }
  731.  
  732.   VIEW_LARGEICONS         = 0;
  733.   VIEW_SMALLICONS         = 1;
  734.   VIEW_LIST               = 2;
  735.   VIEW_DETAILS            = 3;
  736.   VIEW_SORTNAME           = 4;
  737.   VIEW_SORTSIZE           = 5;
  738.   VIEW_SORTDATE           = 6;
  739.   VIEW_SORTTYPE           = 7;
  740.   VIEW_PARENTFOLDER       = 8;
  741.   VIEW_NETCONNECT         = 9;
  742.   VIEW_NETDISCONNECT      = 10;
  743.   VIEW_NEWFOLDER          = 11;
  744.  
  745. { icon indexes for history bitmap }
  746.  
  747.   HIST_BACK               = 0;
  748.   HIST_FORWARD            = 1;
  749.   HIST_FAVORITES          = 2;
  750.   HIST_ADDTOFAVORITES     = 3;
  751.   HIST_VIEWTREE           = 4;
  752.  
  753.   TB_ADDBUTTONS           = WM_USER + 20;
  754.   TB_INSERTBUTTON         = WM_USER + 21;
  755.   TB_DELETEBUTTON         = WM_USER + 22;
  756.   TB_GETBUTTON            = WM_USER + 23;
  757.   TB_BUTTONCOUNT          = WM_USER + 24;
  758.   TB_COMMANDTOINDEX       = WM_USER + 25;
  759.  
  760. type
  761.   PTBSaveParamsA = ^TTBSaveParamsA;
  762.   PTBSaveParamsW = ^TTBSaveParamsW;
  763.   PTBSaveParams = PTBSaveParamsA;
  764.   TTBSaveParamsA = packed record
  765.     hkr: THandle;
  766.     pszSubKey: PAnsiChar;
  767.     pszValueName: PAnsiChar;
  768.   end;
  769.   TTBSaveParamsW = packed record
  770.     hkr: THandle;
  771.     pszSubKey: PWideChar;
  772.     pszValueName: PWideChar;
  773.   end;
  774.   TTBSaveParams = TTBSaveParamsA;
  775.  
  776. const
  777.   TB_SAVERESTOREA          = WM_USER + 26;
  778.   TB_ADDSTRINGA            = WM_USER + 28;
  779.   TB_GETBUTTONTEXTA        = WM_USER + 45;
  780.   TBN_GETBUTTONINFOA       = TBN_FIRST-0;
  781.  
  782.   TB_SAVERESTOREW          = WM_USER + 76;
  783.   TB_ADDSTRINGW            = WM_USER + 77;
  784.   TB_GETBUTTONTEXTW        = WM_USER + 75;
  785.   TBN_GETBUTTONINFOW       = TBN_FIRST-20;
  786.  
  787.   TB_SAVERESTORE          = TB_SAVERESTOREA;
  788.   TB_ADDSTRING            = TB_ADDSTRINGA;
  789.   TB_GETBUTTONTEXT        = TB_GETBUTTONTEXTA;
  790.   TBN_GETBUTTONINFO       = TBN_GETBUTTONINFOA;
  791.  
  792.   TB_CUSTOMIZE            = WM_USER + 27;
  793.   TB_GETITEMRECT          = WM_USER + 29;
  794.   TB_BUTTONSTRUCTSIZE     = WM_USER + 30;
  795.   TB_SETBUTTONSIZE        = WM_USER + 31;
  796.   TB_SETBITMAPSIZE        = WM_USER + 32;
  797.   TB_AUTOSIZE             = WM_USER + 33;
  798.   TB_GETTOOLTIPS          = WM_USER + 35;
  799.   TB_SETTOOLTIPS          = WM_USER + 36;
  800.   TB_SETPARENT            = WM_USER + 37;
  801.   TB_SETROWS              = WM_USER + 39;
  802.   TB_GETROWS              = WM_USER + 40;
  803.   TB_SETCMDID             = WM_USER + 42;
  804.   TB_CHANGEBITMAP         = WM_USER + 43;
  805.   TB_GETBITMAP            = WM_USER + 44;
  806.   TB_REPLACEBITMAP        = WM_USER + 46;
  807.   TB_SETINDENT            = WM_USER + 47;
  808.   TB_SETIMAGELIST         = WM_USER + 48;
  809.   TB_GETIMAGELIST         = WM_USER + 49;
  810.   TB_LOADIMAGES           = WM_USER + 50;
  811.   TB_GETRECT              = WM_USER + 51; { wParam is the Cmd instead of index }
  812.   TB_SETHOTIMAGELIST      = WM_USER + 52;
  813.   TB_GETHOTIMAGELIST      = WM_USER + 53;
  814.   TB_SETDISABLEDIMAGELIST = WM_USER + 54;
  815.   TB_GETDISABLEDIMAGELIST = WM_USER + 55;
  816.   TB_SETSTYLE             = WM_USER + 56;
  817.   TB_GETSTYLE             = WM_USER + 57;
  818.   TB_GETBUTTONSIZE        = WM_USER + 58;
  819.   TB_SETBUTTONWIDTH       = WM_USER + 59;
  820.   TB_SETMAXTEXTROWS       = WM_USER + 60;
  821.   TB_GETTEXTROWS          = WM_USER + 61;
  822.  
  823. type
  824.   PTBReplaceBitmap = ^TTBReplaceBitmap;
  825.   TTBReplaceBitmap = packed record 
  826.     hInstOld: THandle;
  827.     nIDOld: Cardinal;
  828.     hInstNew: THandle;
  829.     nIDNew: Cardinal;
  830.     nButtons: Integer;
  831.   end;
  832.  
  833. const  
  834.   TBBF_LARGE              = $0001;
  835.  
  836.   TB_GETBITMAPFLAGS       = WM_USER + 41;
  837.  
  838.   TBN_BEGINDRAG           = TBN_FIRST-1;
  839.   TBN_ENDDRAG             = TBN_FIRST-2;
  840.   TBN_BEGINADJUST         = TBN_FIRST-3;
  841.   TBN_ENDADJUST           = TBN_FIRST-4;
  842.   TBN_RESET               = TBN_FIRST-5;
  843.   TBN_QUERYINSERT         = TBN_FIRST-6;
  844.   TBN_QUERYDELETE         = TBN_FIRST-7;
  845.   TBN_TOOLBARCHANGE       = TBN_FIRST-8;
  846.   TBN_CUSTHELP            = TBN_FIRST-9;
  847.   TBN_DROPDOWN            = TBN_FIRST-10;
  848.   TBN_CLOSEUP             = TBN_FIRST-11;
  849.  
  850. type
  851.   PNMToolBarA = ^TNMToolBarA;
  852.   PNMToolBarW = ^TNMToolBarW;
  853.   PNMToolBar = PNMToolBarA;
  854.   TNMToolBarA = packed record
  855.     hdr: TNMHdr;
  856.     iItem: Integer;
  857.     tbButton: TTBButton;
  858.     cchText: Integer;
  859.     pszText: PAnsiChar;
  860.   end;
  861.   TNMToolBarW = packed record
  862.     hdr: TNMHdr;
  863.     iItem: Integer;
  864.     tbButton: TTBButton;
  865.     cchText: Integer;
  866.     pszText: PWideChar;
  867.   end;
  868.   TNMToolBar = TNMToolBarA;
  869.  
  870. { ====== REBAR CONTROL =================== }
  871.  
  872. const
  873.   REBARCLASSNAME = 'ReBarWindow32';
  874.  
  875. type
  876.   PReBarInfo = ^TReBarInfo;
  877.   TReBarInfo = packed record
  878.     cbSize: UINT;
  879.     fMask: UINT;
  880.     himl: HImageList;
  881.   end;
  882.  
  883. const
  884.  
  885.   RBIM_IMAGELIST    = $00000001;
  886.  
  887.   RBS_TOOLTIPS      = $00000100;
  888.   RBS_VARHEIGHT     = $00000200;
  889.   RBS_BANDBORDERS   = $00000400;
  890.   RBS_FIXEDORDER    = $00000800;
  891.  
  892.   RBBS_BREAK        = $00000001;  // break to new line
  893.   RBBS_FIXEDSIZE    = $00000002;  // band can't be sized
  894.   RBBS_CHILDEDGE    = $00000004;  // edge around top and bottom of child window
  895.   RBBS_HIDDEN       = $00000008;  // don't show
  896.   RBBS_NOVERT       = $00000010;  // don't show when vertical
  897.   RBBS_FIXEDBMP     = $00000020;  // bitmap doesn't move during band resize
  898.  
  899.   RBBIM_STYLE       = $00000001;
  900.   RBBIM_COLORS      = $00000002;
  901.   RBBIM_TEXT        = $00000004;
  902.   RBBIM_IMAGE       = $00000008;
  903.   RBBIM_CHILD       = $00000010;
  904.   RBBIM_CHILDSIZE   = $00000020;
  905.   RBBIM_SIZE        = $00000040;
  906.   RBBIM_BACKGROUND  = $00000080;
  907.   RBBIM_ID          = $00000100;
  908.  
  909. type
  910.  
  911.   PReBarBandInfoA = ^TReBarBandInfoA;
  912.   PReBarBandInfoW = ^TReBarBandInfoW;
  913.   PReBarBandInfo = PReBarBandInfoA;
  914.   TReBarBandInfoA = packed record
  915.     cbSize: UINT;
  916.     fMask: UINT;
  917.     fStyle: UINT;
  918.     clrFore: TColorRef;
  919.     clrBack: TColorRef;
  920.     lpText: PAnsiChar;
  921.     cch: UINT;
  922.     iImage: Integer;
  923.     hwndChild: HWnd;
  924.     cxMinChild: UINT;
  925.     cyMinChild: UINT;
  926.     cx: UINT;
  927.     hbmBack: HBitmap;
  928.     wID: UINT;
  929.   end;
  930.   TReBarBandInfoW = packed record
  931.     cbSize: UINT;
  932.     fMask: UINT;
  933.     fStyle: UINT;
  934.     clrFore: TColorRef;
  935.     clrBack: TColorRef;
  936.     lpText: PWideChar;
  937.     cch: UINT;
  938.     iImage: Integer;
  939.     hwndChild: HWnd;
  940.     cxMinChild: UINT;
  941.     cyMinChild: UINT;
  942.     cx: UINT;
  943.     hbmBack: HBitmap;
  944.     wID: UINT;
  945.   end;
  946.   TReBarBandInfo = TReBarBandInfoA;
  947.  
  948. const
  949.   RB_INSERTBANDA     = (WM_USER +  1);
  950.   RB_DELETEBAND      = (WM_USER +  2);
  951.   RB_GETBARINFO      = (WM_USER +  3);
  952.   RB_SETBARINFO      = (WM_USER +  4);
  953.   RB_GETBANDINFO     = (WM_USER +  5);
  954.   RB_SETBANDINFOA    = (WM_USER +  6);
  955.   RB_SETPARENT       = (WM_USER +  7);
  956.   RB_INSERTBANDW     = (WM_USER +  10);
  957.   RB_SETBANDINFOW    = (WM_USER +  11);
  958.   RB_GETBANDCOUNT    = (WM_USER +  12);
  959.   RB_GETROWCOUNT     = (WM_USER +  13);
  960.   RB_GETROWHEIGHT    = (WM_USER +  14);
  961.  
  962.   RB_INSERTBAND      = RB_INSERTBANDA;
  963.   RB_SETBANDINFO     = RB_SETBANDINFOA;
  964.  
  965.   RBN_HEIGHTCHANGE   = (RBN_FIRST - 0);
  966.  
  967.  
  968. { ====== TOOLTIPS CONTROL ========================== }
  969.  
  970. const
  971.   TOOTIPS_CLASS = 'tooltips_class32';
  972.  
  973. type
  974.   PToolInfoA = ^TToolInfoA;
  975.   PToolInfoW = ^TToolInfoW;
  976.   PToolInfo = PToolInfoA;
  977.   TToolInfoA = packed record
  978.     cbSize: UINT;
  979.     uFlags: UINT;
  980.     hwnd: HWND;
  981.     uId: UINT;
  982.     Rect: TRect;
  983.     hInst: THandle;
  984.     lpszText: PAnsiChar;
  985.   end;
  986.   TToolInfoW = packed record
  987.     cbSize: UINT;
  988.     uFlags: UINT;
  989.     hwnd: HWND;
  990.     uId: UINT;
  991.     Rect: TRect;
  992.     hInst: THandle;
  993.     lpszText: PWideChar;
  994.   end;
  995.   TToolInfo = TToolInfoA;
  996.  
  997. const
  998.   TTS_ALWAYSTIP           = $01;
  999.   TTS_NOPREFIX            = $02;
  1000.  
  1001.   TTF_IDISHWND            = $0001;
  1002.   TTF_CENTERTIP           = $0002;
  1003.   TTF_RTLREADING          = $0004;
  1004.   TTF_SUBCLASS            = $0010;
  1005.  
  1006.   TTDT_AUTOMATIC          = 0;
  1007.   TTDT_RESHOW             = 1;
  1008.   TTDT_AUTOPOP            = 2;
  1009.   TTDT_INITIAL            = 3;
  1010.  
  1011.   TTM_ACTIVATE            = WM_USER + 1;
  1012.   TTM_SETDELAYTIME        = WM_USER + 3;
  1013.  
  1014.   TTM_ADDTOOLA             = WM_USER + 4;
  1015.   TTM_DELTOOLA             = WM_USER + 5;
  1016.   TTM_NEWTOOLRECTA         = WM_USER + 6;
  1017.   TTM_GETTOOLINFOA         = WM_USER + 8;
  1018.   TTM_SETTOOLINFOA         = WM_USER + 9;
  1019.   TTM_HITTESTA             = WM_USER + 10;
  1020.   TTM_GETTEXTA             = WM_USER + 11;
  1021.   TTM_UPDATETIPTEXTA       = WM_USER + 12;
  1022.   TTM_ENUMTOOLSA           = WM_USER + 14;
  1023.   TTM_GETCURRENTTOOLA      = WM_USER + 15;
  1024.  
  1025.   TTM_ADDTOOLW             = WM_USER + 50;
  1026.   TTM_DELTOOLW             = WM_USER + 51;
  1027.   TTM_NEWTOOLRECTW         = WM_USER + 52;
  1028.   TTM_GETTOOLINFOW         = WM_USER + 53;
  1029.   TTM_SETTOOLINFOW         = WM_USER + 54;
  1030.   TTM_HITTESTW             = WM_USER + 55;
  1031.   TTM_GETTEXTW             = WM_USER + 56;
  1032.   TTM_UPDATETIPTEXTW       = WM_USER + 57;
  1033.   TTM_ENUMTOOLSW           = WM_USER + 58;
  1034.   TTM_GETCURRENTTOOLW      = WM_USER + 59;
  1035.   TTM_WINDOWFROMPOINT      = WM_USER + 16; 
  1036.  
  1037.   TTM_ADDTOOL             = TTM_ADDTOOLA;
  1038.   TTM_DELTOOL             = TTM_DELTOOLA;
  1039.   TTM_NEWTOOLRECT         = TTM_NEWTOOLRECTA;
  1040.   TTM_GETTOOLINFO         = TTM_GETTOOLINFOA;
  1041.   TTM_SETTOOLINFO         = TTM_SETTOOLINFOA;
  1042.   TTM_HITTEST             = TTM_HITTESTA;
  1043.   TTM_GETTEXT             = TTM_GETTEXTA;
  1044.   TTM_UPDATETIPTEXT       = TTM_UPDATETIPTEXTA;
  1045.   TTM_ENUMTOOLS           = TTM_ENUMTOOLSA;
  1046.   TTM_GETCURRENTTOOL      = TTM_GETCURRENTTOOLA;
  1047.  
  1048.   TTM_RELAYEVENT          = WM_USER + 7;
  1049.   TTM_GETTOOLCOUNT        = WM_USER +13;
  1050.  
  1051.  
  1052. type
  1053.   PTTHitTestInfoA = ^TTTHitTestInfoA;
  1054.   PTTHitTestInfoW = ^TTTHitTestInfoW;
  1055.   PTTHitTestInfo = PTTHitTestInfoA;
  1056.   TTTHitTestInfoA = packed record
  1057.     hwnd: HWND;
  1058.     pt: TPoint;
  1059.     ti: TToolInfoA;
  1060.   end;
  1061.   TTTHitTestInfoW = packed record
  1062.     hwnd: HWND;
  1063.     pt: TPoint;
  1064.     ti: TToolInfoW;
  1065.   end;
  1066.   TTTHitTestInfo = TTTHitTestInfoA;
  1067.  
  1068.  
  1069. const
  1070.   TTN_NEEDTEXTA            = TTN_FIRST - 0;
  1071.   TTN_NEEDTEXTW            = TTN_FIRST - 10;
  1072.  
  1073.   TTN_NEEDTEXT            = TTN_NEEDTEXTA;
  1074.  
  1075.   TTN_SHOW                = TTN_FIRST - 1;
  1076.   TTN_POP                 = TTN_FIRST - 2;
  1077.  
  1078. type
  1079.   PToolTipTextA = ^TToolTipTextA;
  1080.   PToolTipTextW = ^TToolTipTextW;
  1081.   PToolTipText = PToolTipTextA;
  1082.   TToolTipTextA = packed record
  1083.     hdr: TNMHDR;
  1084.     lpszText: PAnsiChar;
  1085.     szText: array[0..79] of AnsiChar;
  1086.     hinst: THandle;
  1087.     uFlags: UINT;
  1088.   end;
  1089.   TToolTipTextW = packed record
  1090.     hdr: TNMHDR;
  1091.     lpszText: PWideChar;
  1092.     szText: array[0..79] of WideChar;
  1093.     hinst: THandle;
  1094.     uFlags: UINT;
  1095.   end;
  1096.   TToolTipText = TToolTipTextA;
  1097.  
  1098.  
  1099. { ====== STATUS BAR CONTROL ================= }
  1100.  
  1101. const
  1102.   SBARS_SIZEGRIP          = $0100;
  1103.  
  1104. procedure DrawStatusTextA(hDC: HDC; lprc: PRect; pzsText: PAnsiChar;
  1105.   uFlags: UINT); stdcall;
  1106. procedure DrawStatusTextW(hDC: HDC; lprc: PRect; pzsText: PWideChar;
  1107.   uFlags: UINT); stdcall;
  1108. procedure DrawStatusText(hDC: HDC; lprc: PRect; pzsText: PChar;
  1109.   uFlags: UINT); stdcall;
  1110. function CreateStatusWindowA(Style: Longint; lpszText: PAnsiChar;
  1111.   hwndParent: HWND; wID: UINT): HWND; stdcall;
  1112. function CreateStatusWindowW(Style: Longint; lpszText: PWideChar;
  1113.   hwndParent: HWND; wID: UINT): HWND; stdcall;
  1114. function CreateStatusWindow(Style: Longint; lpszText: PChar;
  1115.   hwndParent: HWND; wID: UINT): HWND; stdcall;
  1116.  
  1117. const
  1118.   STATUSCLASSNAME = 'msctls_statusbar32';
  1119.  
  1120. const
  1121.   SB_SETTEXTA             = WM_USER+1;
  1122.   SB_GETTEXTA             = WM_USER+2;
  1123.   SB_GETTEXTLENGTHA       = WM_USER+3;
  1124.  
  1125.   SB_SETTEXTW             = WM_USER+11;
  1126.   SB_GETTEXTW             = WM_USER+13;
  1127.   SB_GETTEXTLENGTHW       = WM_USER+12;
  1128.  
  1129.   SB_SETTEXT             = SB_SETTEXTA;
  1130.   SB_GETTEXT             = SB_GETTEXTA;
  1131.   SB_GETTEXTLENGTH       = SB_GETTEXTLENGTHA;
  1132.  
  1133.   SB_SETPARTS             = WM_USER+4;
  1134.   SB_GETPARTS             = WM_USER+6;
  1135.   SB_GETBORDERS           = WM_USER+7;
  1136.   SB_SETMINHEIGHT         = WM_USER+8;
  1137.   SB_SIMPLE               = WM_USER+9;
  1138.   SB_GETRECT              = WM_USER + 10;
  1139.  
  1140.   SBT_OWNERDRAW            = $1000;
  1141.   SBT_NOBORDERS            = $0100;
  1142.   SBT_POPOUT               = $0200;
  1143.   SBT_RTLREADING           = $0400;
  1144.  
  1145.  
  1146. { ====== MENU HELP ========================== }
  1147.  
  1148. procedure MenuHelp(Msg: UINT; wParam: WPARAM; lParam: LPARAM;
  1149.   hMainMenu: HMENU; hInst: THandle; hwndStatus: HWND; lpwIDs: PUINT); stdcall;
  1150. function ShowHideMenuCtl(hWnd: HWND; uFlags: UINT; lpInfo: PINT): Bool; stdcall;
  1151. procedure GetEffectiveClientRect(hWnd: HWND; lprc: PRect; lpInfo: PINT); stdcall;
  1152.  
  1153. const
  1154.   MINSYSCOMMAND   = SC_SIZE;
  1155.  
  1156.  
  1157. { ====== TRACKBAR CONTROL =================== }
  1158.  
  1159.   TRACKBAR_CLASS = 'msctls_trackbar32';
  1160.  
  1161. const
  1162.   TBS_AUTOTICKS           = $0001;
  1163.   TBS_VERT                = $0002;
  1164.   TBS_HORZ                = $0000;
  1165.   TBS_TOP                 = $0004;
  1166.   TBS_BOTTOM              = $0000;
  1167.   TBS_LEFT                = $0004;
  1168.   TBS_RIGHT               = $0000;
  1169.   TBS_BOTH                = $0008;
  1170.   TBS_NOTICKS             = $0010;
  1171.   TBS_ENABLESELRANGE      = $0020;
  1172.   TBS_FIXEDLENGTH         = $0040;
  1173.   TBS_NOTHUMB             = $0080;
  1174.  
  1175.   TBM_GETPOS              = WM_USER;
  1176.   TBM_GETRANGEMIN         = WM_USER+1;
  1177.   TBM_GETRANGEMAX         = WM_USER+2;
  1178.   TBM_GETTIC              = WM_USER+3;
  1179.   TBM_SETTIC              = WM_USER+4;
  1180.   TBM_SETPOS              = WM_USER+5;
  1181.   TBM_SETRANGE            = WM_USER+6;
  1182.   TBM_SETRANGEMIN         = WM_USER+7;
  1183.   TBM_SETRANGEMAX         = WM_USER+8;
  1184.   TBM_CLEARTICS           = WM_USER+9;
  1185.   TBM_SETSEL              = WM_USER+10;
  1186.   TBM_SETSELSTART         = WM_USER+11;
  1187.   TBM_SETSELEND           = WM_USER+12;
  1188.   TBM_GETPTICS            = WM_USER+14;
  1189.   TBM_GETTICPOS           = WM_USER+15;
  1190.   TBM_GETNUMTICS          = WM_USER+16;
  1191.   TBM_GETSELSTART         = WM_USER+17;
  1192.   TBM_GETSELEND           = WM_USER+18;
  1193.   TBM_CLEARSEL            = WM_USER+19;
  1194.   TBM_SETTICFREQ          = WM_USER+20;
  1195.   TBM_SETPAGESIZE         = WM_USER+21;
  1196.   TBM_GETPAGESIZE         = WM_USER+22;
  1197.   TBM_SETLINESIZE         = WM_USER+23;
  1198.   TBM_GETLINESIZE         = WM_USER+24;
  1199.   TBM_GETTHUMBRECT        = WM_USER+25;
  1200.   TBM_GETCHANNELRECT      = WM_USER+26;
  1201.   TBM_SETTHUMBLENGTH      = WM_USER+27;
  1202.   TBM_GETTHUMBLENGTH      = WM_USER+28;
  1203.  
  1204.   TB_LINEUP               = 0;
  1205.   TB_LINEDOWN             = 1;
  1206.   TB_PAGEUP               = 2;
  1207.   TB_PAGEDOWN             = 3;
  1208.   TB_THUMBPOSITION        = 4;
  1209.   TB_THUMBTRACK           = 5;
  1210.   TB_TOP                  = 6;
  1211.   TB_BOTTOM               = 7;
  1212.   TB_ENDTRACK             = 8;
  1213.  
  1214.  
  1215.  
  1216. { ====== DRAG LIST CONTROL ================== }
  1217.  
  1218. type
  1219.   PDragListInfo = ^TDragListInfo;
  1220.   TDragListInfo = packed record
  1221.     uNotification: UINT;
  1222.     hWnd: HWND;
  1223.     ptCursor: TPoint;
  1224.   end;
  1225.  
  1226. const
  1227.   DL_BEGINDRAG            = WM_USER+133;
  1228.   DL_DRAGGING             = WM_USER+134;
  1229.   DL_DROPPED              = WM_USER+135;
  1230.   DL_CANCELDRAG           = WM_USER+136;
  1231.  
  1232.   DL_CURSORSET            = 0;
  1233.   DL_STOPCURSOR           = 1;
  1234.   DL_COPYCURSOR           = 2;
  1235.   DL_MOVECURSOR           = 3;
  1236.  
  1237. const
  1238.   DRAGLISTMSGSTRING = 'commctrl_DragListMsg';
  1239.  
  1240. procedure MakeDragList(hLB: HWND); stdcall;
  1241. procedure DrawInsert(hwndParent: HWND; hLB: HWND; nItem: Integer); stdcall;
  1242. function LBItemFromPt(hLB: HWND; pt: TPoint; bAutoScroll: Bool): Integer; stdcall;
  1243.  
  1244.  
  1245. { ====== UPDOWN CONTROL ========================== }
  1246.  
  1247. const
  1248.   UPDOWN_CLASS = 'msctls_updown32';
  1249.  
  1250. type
  1251.   PUDAccel = ^TUDAccel;
  1252.   TUDAccel = packed record
  1253.     nSec: UINT;
  1254.     nInc: UINT;
  1255.   end;
  1256.  
  1257. const
  1258.   UD_MAXVAL               = $7fff;
  1259.   UD_MINVAL               = -UD_MAXVAL;
  1260.  
  1261.   UDS_WRAP                = $0001;
  1262.   UDS_SETBUDDYINT         = $0002;
  1263.   UDS_ALIGNRIGHT          = $0004;
  1264.   UDS_ALIGNLEFT           = $0008;
  1265.   UDS_AUTOBUDDY           = $0010;
  1266.   UDS_ARROWKEYS           = $0020;
  1267.   UDS_HORZ                = $0040;
  1268.   UDS_NOTHOUSANDS         = $0080;
  1269.  
  1270.  
  1271.   UDM_SETRANGE            = WM_USER+101;
  1272.   UDM_GETRANGE            = WM_USER+102;
  1273.   UDM_SETPOS              = WM_USER+103;
  1274.   UDM_GETPOS              = WM_USER+104;
  1275.   UDM_SETBUDDY            = WM_USER+105;
  1276.   UDM_GETBUDDY            = WM_USER+106;
  1277.   UDM_SETACCEL            = WM_USER+107;
  1278.   UDM_GETACCEL            = WM_USER+108;
  1279.   UDM_SETBASE             = WM_USER+109;
  1280.   UDM_GETBASE             = WM_USER+110;
  1281.  
  1282. function CreateUpDownControl(dwStyle: Longint; X, Y, CX, CY: Integer;
  1283.   hParent: HWND;  nID: Integer; hInst: THandle; hBuddy: HWND;
  1284.   nUpper, nLower, nPos: Integer): HWND; stdcall;
  1285.  
  1286. type
  1287.   PNMUpDown = ^TNMUpDown;
  1288.   TNMUpDown = packed record
  1289.     hdr: TNMHDR;
  1290.     iPos: Integer;
  1291.     iDelta: Integer;
  1292.   end;
  1293.  
  1294. const
  1295.   UDN_DELTAPOS = UDN_FIRST - 1;
  1296.  
  1297.  
  1298. { ====== PROGRESS CONTROL ========================= }
  1299.  
  1300. const
  1301.   PROGRESS_CLASS = 'msctls_progress32';
  1302.  
  1303. type
  1304.   PPBRange = ^TPBRange;
  1305.   TPBRange = record
  1306.     ILow: Integer;
  1307.     IHigh: Integer;
  1308.   end;
  1309.  
  1310. const
  1311.   PBM_SETRANGE            = WM_USER+1;
  1312.   PBM_SETPOS              = WM_USER+2;
  1313.   PBM_DELTAPOS            = WM_USER+3;
  1314.   PBM_SETSTEP             = WM_USER+4;
  1315.   PBM_STEPIT              = WM_USER+5;
  1316.   PBM_SETRANGE32          = WM_USER+6;   // lParam = high, wParam = low
  1317.   PBM_GETRANGE            = WM_USER+7;   // lParam = PPBRange or Nil
  1318.                      // wParam = False: Result = high
  1319.                      // wParam = True: Result = low
  1320.   PBM_GETPOS              = WM_USER+8;
  1321.  
  1322.  
  1323. {  ====== HOTKEY CONTROL ========================== }
  1324.  
  1325. const
  1326.   HOTKEYF_SHIFT           = $01;
  1327.   HOTKEYF_CONTROL         = $02;
  1328.   HOTKEYF_ALT             = $04;
  1329.   HOTKEYF_EXT             = $08;
  1330.  
  1331.   HKCOMB_NONE             = $0001;
  1332.   HKCOMB_S                = $0002;
  1333.   HKCOMB_C                = $0004;
  1334.   HKCOMB_A                = $0008;
  1335.   HKCOMB_SC               = $0010;
  1336.   HKCOMB_SA               = $0020;
  1337.   HKCOMB_CA               = $0040;
  1338.   HKCOMB_SCA              = $0080;
  1339.  
  1340.  
  1341.   HKM_SETHOTKEY           = WM_USER+1;
  1342.   HKM_GETHOTKEY           = WM_USER+2;
  1343.   HKM_SETRULES            = WM_USER+3;
  1344.  
  1345. const
  1346.   HOTKEYCLASS = 'msctls_hotkey32';
  1347.  
  1348.  
  1349. { ====== COMMON CONTROL STYLES ================ }
  1350.  
  1351. const
  1352.   CCS_TOP                 = $00000001;
  1353.   CCS_NOMOVEY             = $00000002;
  1354.   CCS_BOTTOM              = $00000003;
  1355.   CCS_NORESIZE            = $00000004;
  1356.   CCS_NOPARENTALIGN       = $00000008;
  1357.   CCS_ADJUSTABLE          = $00000020;
  1358.   CCS_NODIVIDER           = $00000040;
  1359.   CCS_VERT                = $00000080;
  1360.   CCS_LEFT                = (CCS_VERT or CCS_TOP);
  1361.   CCS_RIGHT               = (CCS_VERT or CCS_BOTTOM);
  1362.   CCS_NOMOVEX             = (CCS_VERT or CCS_NOMOVEY);
  1363.  
  1364.  
  1365. { ====== LISTVIEW CONTROL ====================== }
  1366.  
  1367. const
  1368.   WC_LISTVIEW = 'SysListView32';
  1369.  
  1370. const
  1371.  
  1372.   { List View Styles }
  1373.   LVS_ICON                = $0000;
  1374.   LVS_REPORT              = $0001;
  1375.   LVS_SMALLICON           = $0002;
  1376.   LVS_LIST                = $0003;
  1377.   LVS_TYPEMASK            = $0003;
  1378.   LVS_SINGLESEL           = $0004;
  1379.   LVS_SHOWSELALWAYS       = $0008;
  1380.   LVS_SORTASCENDING       = $0010;
  1381.   LVS_SORTDESCENDING      = $0020;
  1382.   LVS_SHAREIMAGELISTS     = $0040;
  1383.   LVS_NOLABELWRAP         = $0080;
  1384.   LVS_AUTOARRANGE         = $0100;
  1385.   LVS_EDITLABELS          = $0200;
  1386.   LVS_OWNERDATA           = $1000; 
  1387.   LVS_NOSCROLL            = $2000;
  1388.  
  1389.   LVS_TYPESTYLEMASK       = $FC00;
  1390.  
  1391.   LVS_ALIGNTOP            = $0000;
  1392.   LVS_ALIGNLEFT           = $0800;
  1393.   LVS_ALIGNMASK           = $0c00;
  1394.  
  1395.   LVS_OWNERDRAWFIXED      = $0400;
  1396.   LVS_NOCOLUMNHEADER      = $4000;
  1397.   LVS_NOSORTHEADER        = $8000;
  1398.  
  1399.   { List View Extended Styles }
  1400.   LVS_EX_GRIDLINES        = $00000001;
  1401.   LVS_EX_SUBITEMIMAGES    = $00000002;
  1402.   LVS_EX_CHECKBOXES       = $00000004;
  1403.   LVS_EX_TRACKSELECT      = $00000008;
  1404.   LVS_EX_HEADERDRAGDROP   = $00000010;
  1405.   LVS_EX_FULLROWSELECT    = $00000020; // applies to report mode only
  1406.   LVS_EX_ONECLICKACTIVATE = $00000040;
  1407.   LVS_EX_TWOCLICKACTIVATE = $00000080;
  1408.  
  1409. const
  1410.   LVM_GETBKCOLOR          = LVM_FIRST + 0;
  1411.  
  1412. function ListView_GetBkColor(hWnd: HWND): TColorRef;
  1413.  
  1414. const
  1415.   LVM_SETBKCOLOR          = LVM_FIRST + 1;
  1416.  
  1417. function ListView_SetBkColor(hWnd: HWND; clrBk: TColorRef): Bool;
  1418.  
  1419. const
  1420.   LVM_GETIMAGELIST        = LVM_FIRST + 2;
  1421.  
  1422. function ListView_GetImageList(hWnd: HWND; iImageList: Integer): HImageList;
  1423.  
  1424. const
  1425.   LVSIL_NORMAL            = 0;
  1426.   LVSIL_SMALL             = 1;
  1427.   LVSIL_STATE             = 2;
  1428.  
  1429. const
  1430.   LVM_SETIMAGELIST        = LVM_FIRST + 3;
  1431.  
  1432. function ListView_SetImageList(hWnd: HWND; himl: HImageList;
  1433.   iImageList: Integer): HImageList;
  1434.  
  1435. const
  1436.   LVM_GETITEMCOUNT        = LVM_FIRST + 4;
  1437.  
  1438. function ListView_GetItemCount(hWnd: HWND): Integer;
  1439.  
  1440. const
  1441.   LVIF_TEXT               = $0001;
  1442.   LVIF_IMAGE              = $0002;
  1443.   LVIF_PARAM              = $0004;
  1444.   LVIF_STATE              = $0008;
  1445.  
  1446.   LVIS_FOCUSED            = $0001;
  1447.   LVIS_SELECTED           = $0002;
  1448.   LVIS_CUT                = $0004;
  1449.   LVIS_DROPHILITED        = $0008;
  1450.  
  1451.   LVIS_OVERLAYMASK        = $0F00;
  1452.   LVIS_STATEIMAGEMASK     = $F000;
  1453.  
  1454. function IndexToStateImageMask(I: Longint): Longint;
  1455.  
  1456. type
  1457.   PLVItemA = ^TLVItemA;
  1458.   PLVItemW = ^TLVItemW;
  1459.   PLVItem = PLVItemA;
  1460.   TLVItemA = packed record
  1461.     mask: UINT;
  1462.     iItem: Integer;
  1463.     iSubItem: Integer;
  1464.     state: UINT;
  1465.     stateMask: UINT;
  1466.     pszText: PAnsiChar;
  1467.     cchTextMax: Integer;
  1468.     iImage: Integer;
  1469.     lParam: LPARAM;
  1470.   end;
  1471.   TLVItemW = packed record
  1472.     mask: UINT;
  1473.     iItem: Integer;
  1474.     iSubItem: Integer;
  1475.     state: UINT;
  1476.     stateMask: UINT;
  1477.     pszText: PWideChar;
  1478.     cchTextMax: Integer;
  1479.     iImage: Integer;
  1480.     lParam: LPARAM;
  1481.   end;
  1482.   TLVItem = TLVItemA;
  1483.  
  1484. const
  1485.   LPSTR_TEXTCALLBACKA = LPSTR(-1);
  1486.   LPSTR_TEXTCALLBACKW = LPWSTR(-1);
  1487.  
  1488.   LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKA;
  1489.  
  1490.   I_IMAGECALLBACK         = -1;
  1491.  
  1492. const
  1493.   LVM_GETITEMA            = LVM_FIRST + 5;
  1494.   LVM_SETITEMA            = LVM_FIRST + 6;
  1495.   LVM_INSERTITEMA         = LVM_FIRST + 7;
  1496.  
  1497.   LVM_GETITEMW            = LVM_FIRST + 75;
  1498.   LVM_SETITEMW            = LVM_FIRST + 76;
  1499.   LVM_INSERTITEMW         = LVM_FIRST + 77;
  1500.  
  1501.   LVM_GETITEM            = LVM_GETITEMA;
  1502.   LVM_SETITEM            = LVM_SETITEMA;
  1503.   LVM_INSERTITEM         = LVM_INSERTITEMA;
  1504.  
  1505.   LVM_DELETEITEM          = LVM_FIRST + 8;
  1506.   LVM_DELETEALLITEMS      = LVM_FIRST + 9;
  1507.   LVM_GETCALLBACKMASK     = LVM_FIRST + 10;
  1508.   LVM_SETCALLBACKMASK     = LVM_FIRST + 11;
  1509.  
  1510. function ListView_GetItemA(hWnd: HWND; var pItem: TLVItemA): Bool;
  1511. function ListView_GetItemW(hWnd: HWND; var pItem: TLVItemW): Bool;
  1512. function ListView_GetItem(hWnd: HWND; var pItem: TLVItem): Bool;
  1513. function ListView_SetItemA(hWnd: HWND; const pItem: TLVItemA): Bool;
  1514. function ListView_SetItemW(hWnd: HWND; const pItem: TLVItemW): Bool;
  1515. function ListView_SetItem(hWnd: HWND; const pItem: TLVItem): Bool;
  1516. function ListView_InsertItemA(hWnd: HWND; const pItem: TLVItemA): Integer;
  1517. function ListView_InsertItemW(hWnd: HWND; const pItem: TLVItemW): Integer;
  1518. function ListView_InsertItem(hWnd: HWND; const pItem: TLVItem): Integer;
  1519. function ListView_DeleteItem(hWnd: HWND; i: Integer): Bool;
  1520. function ListView_DeleteAllItems(hWnd: HWND): Bool;
  1521. function ListView_GetCallbackMask(hWnd: HWND): UINT;
  1522. function ListView_SetCallbackMask(hWnd: HWND; mask: UINT): Bool;
  1523.  
  1524. const
  1525.   LVNI_ALL                = $0000;
  1526.   LVNI_FOCUSED            = $0001;
  1527.   LVNI_SELECTED           = $0002;
  1528.   LVNI_CUT                = $0004;
  1529.   LVNI_DROPHILITED        = $0008;
  1530.  
  1531.   LVNI_ABOVE              = $0100;
  1532.   LVNI_BELOW              = $0200;
  1533.   LVNI_TOLEFT             = $0400;
  1534.   LVNI_TORIGHT            = $0800;
  1535.  
  1536.  
  1537. const
  1538.   LVM_GETNEXTITEM         = LVM_FIRST + 12;
  1539.  
  1540. function ListView_GetNextItem(hWnd: HWND; iStart: Integer; Flags: UINT): Integer;
  1541.  
  1542. const
  1543.   LVFI_PARAM              = $0001;
  1544.   LVFI_STRING             = $0002;
  1545.   LVFI_PARTIAL            = $0008;
  1546.   LVFI_WRAP               = $0020;
  1547.   LVFI_NEARESTXY          = $0040;
  1548.  
  1549.  
  1550. type
  1551.   PLVFindInfoA = ^TLVFindInfoA;
  1552.   PLVFindInfoW = ^TLVFindInfoW;
  1553.   PLVFindInfo = PLVFindInfoA;
  1554.   TLVFindInfoA = packed record
  1555.     flags: UINT;
  1556.     psz: PAnsiChar;
  1557.     lParam: LPARAM;
  1558.     pt: TPoint;
  1559.     vkDirection: UINT;
  1560.   end;
  1561.   TLVFindInfoW = packed record
  1562.     flags: UINT;
  1563.     psz: PWideChar;
  1564.     lParam: LPARAM;
  1565.     pt: TPoint;
  1566.     vkDirection: UINT;
  1567.   end;
  1568.   TLVFindInfo = TLVFindInfoA;
  1569.  
  1570. const
  1571.   LVM_FINDITEMA            = LVM_FIRST + 13;
  1572.   LVM_FINDITEMW            = LVM_FIRST + 83;
  1573.   LVM_FINDITEM            = LVM_FINDITEMA;
  1574.  
  1575. function ListView_FindItemA(hWnd: HWND; iStart: Integer;
  1576.   const plvfi: TLVFindInfoA): Integer;
  1577. function ListView_FindItemW(hWnd: HWND; iStart: Integer;
  1578.   const plvfi: TLVFindInfoW): Integer;
  1579. function ListView_FindItem(hWnd: HWND; iStart: Integer;
  1580.   const plvfi: TLVFindInfo): Integer;
  1581.  
  1582. const
  1583.   LVIR_BOUNDS             = 0;
  1584.   LVIR_ICON               = 1;
  1585.   LVIR_LABEL              = 2;
  1586.   LVIR_SELECTBOUNDS       = 3;
  1587.  
  1588.  
  1589. const
  1590.   LVM_GETITEMRECT         = LVM_FIRST + 14;
  1591.  
  1592. function ListView_GetItemRect(hWnd: HWND; i: Integer; var prc: TRect;
  1593.   Code: Integer): Bool;
  1594.  
  1595. const
  1596.   LVM_SETITEMPOSITION     = LVM_FIRST + 15;
  1597.  
  1598. function ListView_SetItemPosition(hWnd: HWND; i, x, y: Integer): Bool;
  1599.  
  1600. const
  1601.   LVM_GETITEMPOSITION     = LVM_FIRST + 16;
  1602.  
  1603. function ListView_GetItemPosition(hwndLV: HWND; i: Integer; var ppt: TPoint): Bool;
  1604.  
  1605. const
  1606.   LVM_GETSTRINGWIDTHA      = LVM_FIRST + 17;
  1607.   LVM_GETSTRINGWIDTHW      = LVM_FIRST + 87;
  1608.   LVM_GETSTRINGWIDTH      = LVM_GETSTRINGWIDTHA;
  1609.  
  1610. function ListView_GetStringWidthA(hwndLV: HWND; psz: PAnsiChar): Integer;
  1611. function ListView_GetStringWidthW(hwndLV: HWND; psz: PWideChar): Integer;
  1612. function ListView_GetStringWidth(hwndLV: HWND; psz: PChar): Integer;
  1613.  
  1614. const
  1615.   LVHT_NOWHERE            = $0001;
  1616.   LVHT_ONITEMICON         = $0002;
  1617.   LVHT_ONITEMLABEL        = $0004;
  1618.   LVHT_ONITEMSTATEICON    = $0008;
  1619.   LVHT_ONITEM             = LVHT_ONITEMICON or LVHT_ONITEMLABEL or
  1620.                 LVHT_ONITEMSTATEICON;
  1621.   LVHT_ABOVE              = $0008;
  1622.   LVHT_BELOW              = $0010;
  1623.   LVHT_TORIGHT            = $0020;
  1624.   LVHT_TOLEFT             = $0040;
  1625.  
  1626. type
  1627.   PLVHitTestInfo = ^TLVHitTestInfo;
  1628.   TLVHitTestInfo = packed record
  1629.     pt: TPoint;
  1630.     flags: UINT;
  1631.     iItem: Integer;
  1632.   end;
  1633.  
  1634. const
  1635.   LVM_HITTEST             = LVM_FIRST + 18;
  1636.  
  1637. function ListView_HitTest(hwndLV: HWND; var pinfo: TLVHitTestInfo): Integer;
  1638.  
  1639. const
  1640.   LVM_ENSUREVISIBLE       = LVM_FIRST + 19;
  1641.  
  1642. function ListView_EnsureVisible(hwndLV: HWND; i: Integer; fPartialOK: Bool): Bool;
  1643.  
  1644. const
  1645.   LVM_SCROLL              = LVM_FIRST + 20;
  1646.  
  1647. function ListView_Scroll(hwndLV: HWnd; DX, DY: Integer): Bool;
  1648.  
  1649. const
  1650.   LVM_REDRAWITEMS         = LVM_FIRST + 21;
  1651.  
  1652. function ListView_RedrawItems(hwndLV: HWND; iFirst, iLast: Integer): Bool;
  1653.  
  1654. const
  1655.   LVA_DEFAULT             = $0000;
  1656.   LVA_ALIGNLEFT           = $0001;
  1657.   LVA_ALIGNTOP            = $0002;
  1658.   LVA_ALIGNRIGHT          = $0003;
  1659.   LVA_ALIGNBOTTOM         = $0004;
  1660.   LVA_SNAPTOGRID          = $0005;
  1661.  
  1662.   LVA_SORTASCENDING       = $0100;
  1663.   LVA_SORTDESCENDING      = $0200;
  1664.  
  1665.   LVM_ARRANGE             = LVM_FIRST + 22;
  1666.  
  1667. function ListView_Arrange(hwndLV: HWND; Code: UINT): Bool;
  1668.  
  1669.  
  1670. const
  1671.   LVM_EDITLABELA           = LVM_FIRST + 23;
  1672.   LVM_EDITLABELW           = LVM_FIRST + 118;
  1673.   LVM_EDITLABEL           = LVM_EDITLABELA;
  1674.  
  1675. function ListView_EditLabelA(hwndLV: HWND; i: Integer): HWND;
  1676. function ListView_EditLabelW(hwndLV: HWND; i: Integer): HWND;
  1677. function ListView_EditLabel(hwndLV: HWND; i: Integer): HWND;
  1678.  
  1679. const
  1680.   LVM_GETEDITCONTROL      = LVM_FIRST + 24;
  1681.  
  1682. function ListView_GetEditControl(hwndLV: HWND): HWND;
  1683.  
  1684. type
  1685.   PLVColumnA = ^TLVColumnA;
  1686.   PLVColumnW = ^TLVColumnW;
  1687.   PLVColumn = PLVColumnA;
  1688.   TLVColumnA = packed record
  1689.     mask: UINT;
  1690.     fmt: Integer;
  1691.     cx: Integer;
  1692.     pszText: PAnsiChar;
  1693.     cchTextMax: Integer;
  1694.     iSubItem: Integer;
  1695.   end;
  1696.   TLVColumnW = packed record
  1697.     mask: UINT;
  1698.     fmt: Integer;
  1699.     cx: Integer;
  1700.     pszText: PWideChar;
  1701.     cchTextMax: Integer;
  1702.     iSubItem: Integer;
  1703.   end;
  1704.   TLVColumn = TLVColumnA;
  1705.  
  1706. const
  1707.   LVCF_FMT                = $0001;
  1708.   LVCF_WIDTH              = $0002;
  1709.   LVCF_TEXT               = $0004;
  1710.   LVCF_SUBITEM            = $0008;
  1711.  
  1712.   LVCFMT_LEFT             = $0000; 
  1713.   LVCFMT_RIGHT            = $0001; 
  1714.   LVCFMT_CENTER           = $0002; 
  1715.   LVCFMT_JUSTIFYMASK      = $0003; 
  1716.  
  1717.   LVM_GETCOLUMNA          = LVM_FIRST + 25;
  1718.   LVM_GETCOLUMNW          = LVM_FIRST + 95;
  1719.   LVM_GETCOLUMN           = LVM_GETCOLUMNA;
  1720.  
  1721. function ListView_GetColumnA(hwnd: HWND; iCol: Integer;
  1722.   var pcol: TLVColumnA): Bool;
  1723. function ListView_GetColumnW(hwnd: HWND; iCol: Integer;
  1724.   var pcol: TLVColumnW): Bool;
  1725. function ListView_GetColumn(hwnd: HWND; iCol: Integer;
  1726.   var pcol: TLVColumn): Bool;
  1727.  
  1728. const
  1729.   LVM_SETCOLUMNA           = LVM_FIRST + 26;
  1730.   LVM_SETCOLUMNW           = LVM_FIRST + 96;
  1731.   LVM_SETCOLUMN           = LVM_SETCOLUMNA;
  1732.  
  1733. function ListView_SetColumnA(hwnd: HWnd; iCol: Integer; const pcol: TLVColumnA): Bool;
  1734. function ListView_SetColumnW(hwnd: HWnd; iCol: Integer; const pcol: TLVColumnW): Bool;
  1735. function ListView_SetColumn(hwnd: HWnd; iCol: Integer; const pcol: TLVColumn): Bool;
  1736.  
  1737. const
  1738.   LVM_INSERTCOLUMNA        = LVM_FIRST + 27;
  1739.   LVM_INSERTCOLUMNW        = LVM_FIRST + 97;
  1740.   LVM_INSERTCOLUMN        = LVM_INSERTCOLUMNA;
  1741.  
  1742. function ListView_InsertColumnA(hwnd: HWND; iCol: Integer;
  1743.   const pcol: TLVColumnA): Integer;
  1744. function ListView_InsertColumnW(hwnd: HWND; iCol: Integer;
  1745.   const pcol: TLVColumnW): Integer;
  1746. function ListView_InsertColumn(hwnd: HWND; iCol: Integer;
  1747.   const pcol: TLVColumn): Integer;
  1748.  
  1749. const
  1750.   LVM_DELETECOLUMN        = LVM_FIRST + 28;
  1751.  
  1752. function ListView_DeleteColumn(hwnd: HWND; iCol: Integer): Bool;
  1753.  
  1754. const
  1755.   LVM_GETCOLUMNWIDTH      = LVM_FIRST + 29;
  1756.  
  1757. function ListView_GetColumnWidth(hwnd: HWND; iCol: Integer): Integer;
  1758.  
  1759. const
  1760.   LVSCW_AUTOSIZE              = -1;
  1761.   LVSCW_AUTOSIZE_USEHEADER    = -2;
  1762.   LVM_SETCOLUMNWIDTH          = LVM_FIRST + 30;
  1763.  
  1764. function ListView_SetColumnWidth(hwnd: HWnd; iCol: Integer; cx: Integer): Bool;
  1765.  
  1766. const
  1767.   LVM_CREATEDRAGIMAGE     = LVM_FIRST + 33;
  1768.  
  1769. function ListView_CreateDragImage(hwnd: HWND; i: Integer;
  1770.   const lpptUpLeft: TPoint): HImageList;
  1771.  
  1772. const
  1773.   LVM_GETVIEWRECT         = LVM_FIRST + 34;
  1774.  
  1775. function ListView_GetViewRect(hwnd: HWND; var prc: TRect): Bool;
  1776.  
  1777. const
  1778.   LVM_GETTEXTCOLOR        = LVM_FIRST + 35;
  1779.  
  1780. function ListView_GetTextColor(hwnd: HWND): TColorRef;
  1781.  
  1782. const
  1783.   LVM_SETTEXTCOLOR        = LVM_FIRST + 36;
  1784.  
  1785. function ListView_SetTextColor(hwnd: HWND; clrText: TColorRef): Bool;
  1786.  
  1787. const
  1788.   LVM_GETTEXTBKCOLOR      = LVM_FIRST + 37;
  1789.  
  1790. function ListView_GetTextBkColor(hwnd: HWND): TColorRef;
  1791.  
  1792. const
  1793.   LVM_SETTEXTBKCOLOR      = LVM_FIRST + 38;
  1794.  
  1795. function ListView_SetTextBkColor(hwnd: HWND; clrTextBk: TColorRef): Bool;
  1796.  
  1797. const
  1798.   LVM_GETTOPINDEX         = LVM_FIRST + 39;
  1799.  
  1800. function ListView_GetTopIndex(hwndLV: HWND): Integer;
  1801.  
  1802. const
  1803.   LVM_GETCOUNTPERPAGE     = LVM_FIRST + 40;
  1804.  
  1805. function ListView_GetCountPerPage(hwndLV: HWND): Integer;
  1806.  
  1807. const
  1808.   LVM_GETORIGIN           = LVM_FIRST + 41;
  1809.  
  1810. function ListView_GetOrigin(hwndLV: HWND; var ppt: TPoint): Bool;
  1811.  
  1812. const
  1813.   LVM_UPDATE              = LVM_FIRST + 42;
  1814.  
  1815. function ListView_Update(hwndLV: HWND; i: Integer): Bool;
  1816.  
  1817. const
  1818.   LVM_SETITEMSTATE        = LVM_FIRST + 43;
  1819.  
  1820. function ListView_SetItemState(hwndLV: HWND; i: Integer; data, mask: UINT): Bool;
  1821.  
  1822. const
  1823.   LVM_GETITEMSTATE        = LVM_FIRST + 44;
  1824.  
  1825. function ListView_GetItemState(hwndLV: HWND; i, mask: Integer): Integer;
  1826.  
  1827. function ListView_GetCheckState(hwndLV: HWND; i: Integer): UINT;
  1828. procedure ListView_SetCheckState(hwndLV: HWND; i: Integer; Checked: Boolean);
  1829.  
  1830. const
  1831.   LVM_GETITEMTEXTA         = LVM_FIRST + 45;
  1832.   LVM_GETITEMTEXTW         = LVM_FIRST + 115;
  1833.   LVM_GETITEMTEXT         = LVM_GETITEMTEXTA;
  1834.  
  1835. function ListView_GetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  1836.   pszText: PAnsiChar; cchTextMax: Integer): Integer;
  1837. function ListView_GetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  1838.   pszText: PWideChar; cchTextMax: Integer): Integer;
  1839. function ListView_GetItemText(hwndLV: HWND; i, iSubItem: Integer;
  1840.   pszText: PChar; cchTextMax: Integer): Integer;
  1841.  
  1842. const
  1843.   LVM_SETITEMTEXTA         = LVM_FIRST + 46;
  1844.   LVM_SETITEMTEXTW         = LVM_FIRST + 116;
  1845.   LVM_SETITEMTEXT         = LVM_SETITEMTEXTA;
  1846.  
  1847. function ListView_SetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  1848.   pszText: PAnsiChar): Bool;
  1849. function ListView_SetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  1850.   pszText: PWideChar): Bool;
  1851. function ListView_SetItemText(hwndLV: HWND; i, iSubItem: Integer;
  1852.   pszText: PChar): Bool;
  1853.  
  1854. const
  1855.   LVM_SETITEMCOUNT        = LVM_FIRST + 47;
  1856.  
  1857. procedure ListView_SetItemCount(hwndLV: HWND; cItems: Integer);
  1858.  
  1859. type
  1860.   TLVCompare = function(lParam1, lParam2, lParamSort: Integer): Integer stdcall;
  1861.  
  1862. const
  1863.   LVM_SORTITEMS           = LVM_FIRST + 48;
  1864.  
  1865. function ListView_SortItems(hwndLV: HWND; pfnCompare: TLVCompare;
  1866.   lPrm: Longint): Bool;
  1867.  
  1868. const
  1869.   LVM_SETITEMPOSITION32   = LVM_FIRST + 49;
  1870.  
  1871. procedure ListView_SetItemPosition32(hwndLV: HWND; i, x, y: Integer);
  1872.  
  1873. const
  1874.   LVM_GETSELECTEDCOUNT    = LVM_FIRST + 50;
  1875.  
  1876. function ListView_GetSelectedCount(hwndLV: HWND): UINT;
  1877.  
  1878. const
  1879.   LVM_GETITEMSPACING      = LVM_FIRST + 51;
  1880.  
  1881. function ListView_GetItemSpacing(hwndLV: HWND; fSmall: Integer): Longint;
  1882.  
  1883. const
  1884.   LVM_GETISEARCHSTRINGA    = LVM_FIRST + 52;
  1885.   LVM_GETISEARCHSTRINGW    = LVM_FIRST + 117;
  1886.   LVM_GETISEARCHSTRING    = LVM_GETISEARCHSTRINGA;
  1887.  
  1888. function ListView_GetISearchStringA(hwndLV: HWND; lpsz: PAnsiChar): Bool;
  1889. function ListView_GetISearchStringW(hwndLV: HWND; lpsz: PWideChar): Bool;
  1890. function ListView_GetISearchString(hwndLV: HWND; lpsz: PChar): Bool;
  1891.  
  1892. const
  1893.   LVM_SETICONSPACING      = LVM_FIRST + 53;
  1894.  
  1895. // -1 for cx and cy means we'll use the default (system settings)
  1896. // 0 for cx or cy means use the current setting (allows you to change just one param)
  1897. function ListView_SetIconSpacing(hwndLV: HWND; cx, cy: Word): DWORD;
  1898.  
  1899. const
  1900.   LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
  1901.  
  1902. function ListView_SetExtendedListViewStyle(hwndLV: HWND; dw: DWORD): BOOL;
  1903.  
  1904. const
  1905.   LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55;
  1906.  
  1907. function ListView_GetExtendedListViewStyle(hwndLV: HWND): DWORD;
  1908.  
  1909. const
  1910.   LVM_GETSUBITEMRECT      = LVM_FIRST + 56;
  1911.  
  1912. function ListView_GetSubItemRect(hwndLV: HWND; iItem, iSubItem: Integer;
  1913.   code: DWORD; prc: PRect): BOOL;
  1914.  
  1915. const
  1916.   LVM_SUBITEMHITTEST      = LVM_FIRST + 57;
  1917.  
  1918. function ListView_SubItemHitTest(hwndLV: HWND; plvhti: PLVHitTestInfo): Integer;
  1919.  
  1920. const
  1921.   LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58;
  1922.  
  1923. function ListView_SetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  1924.   pi: PInteger): BOOL;
  1925.  
  1926. const
  1927.   LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59;
  1928.  
  1929. function ListView_GetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  1930.   pi: PInteger): BOOL;
  1931.  
  1932. const
  1933.   LVM_SETHOTITEM  = LVM_FIRST + 60;
  1934.  
  1935. function ListView_SetHotItem(hwndLV: HWND; i: Integer): Integer;
  1936.  
  1937. const
  1938.   LVM_GETHOTITEM  = LVM_FIRST + 61;
  1939.  
  1940. function ListView_GetHotItem(hwndLV: HWND): Integer;
  1941.  
  1942. const
  1943.   LVM_SETHOTCURSOR  = LVM_FIRST + 62;
  1944.  
  1945. function ListView_SetHotCursor(hwndLV: HWND; hcur: HCURSOR): HCURSOR;
  1946.  
  1947. const
  1948.   LVM_GETHOTCURSOR  = LVM_FIRST + 63;
  1949.  
  1950. function ListView_GetHotCursor(hwndLV: HWND): HCURSOR;
  1951.  
  1952. const
  1953.   LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64;
  1954.  
  1955. function ListView_ApproximateViewRect(hwndLV: HWND; iWidth, iHeight: Word;
  1956.   iCount: Integer): DWORD;
  1957.  
  1958. const
  1959.   LVM_SETWORKAREA         = LVM_FIRST + 65;
  1960.  
  1961. function ListView_SetWorkArea(hwndLV: HWND; prc: PRect): BOOL;
  1962.  
  1963. type
  1964.   PNMListView = ^TNMListView;
  1965.   TNMListView = packed record
  1966.     hdr: TNMHDR;
  1967.     iItem: Integer;
  1968.     iSubItem: Integer;
  1969.     uNewState: UINT;
  1970.     uOldState: UINT;
  1971.     uChanged: UINT;
  1972.     ptAction: TPoint;
  1973.     lParam: LPARAM;
  1974.   end;
  1975.  
  1976.   PNMCacheHint = ^TNMCacheHint;
  1977.   TNMCacheHint = packed record
  1978.     hdr: TNMHDR;
  1979.     iFrom: Integer;
  1980.     iTo: Integer;
  1981.   end;
  1982.  
  1983.   PNMFinditem = ^TNMFinditem;
  1984.   TNMFinditem = packed record
  1985.     hdr: TNMHDR;
  1986.     iStart: Integer;
  1987.     lvfi: TLVFindInfo;
  1988.   end;
  1989.  
  1990. const
  1991.   LVN_ITEMCHANGING        = LVN_FIRST-0;
  1992.   LVN_ITEMCHANGED         = LVN_FIRST-1;
  1993.   LVN_INSERTITEM          = LVN_FIRST-2;
  1994.   LVN_DELETEITEM          = LVN_FIRST-3;
  1995.   LVN_DELETEALLITEMS      = LVN_FIRST-4;
  1996.   LVN_COLUMNCLICK         = LVN_FIRST-8;
  1997.   LVN_BEGINDRAG           = LVN_FIRST-9;
  1998.   LVN_BEGINRDRAG          = LVN_FIRST-11;
  1999.  
  2000.   LVN_ODCACHEHINT         = LVN_FIRST-13;
  2001.   LVN_ODFINDITEMA         = LVN_FIRST-52;
  2002.   LVN_ODFINDITEMW         = LVN_FIRST-79;
  2003.  
  2004.   LVN_ODFINDITEM          = LVN_ODFINDITEMA; 
  2005.  
  2006.   LVN_BEGINLABELEDITA      = LVN_FIRST-5;
  2007.   LVN_ENDLABELEDITA        = LVN_FIRST-6;
  2008.   LVN_BEGINLABELEDITW      = LVN_FIRST-75;
  2009.   LVN_ENDLABELEDITW        = LVN_FIRST-76;
  2010.   LVN_BEGINLABELEDIT      = LVN_BEGINLABELEDITA;
  2011.   LVN_ENDLABELEDIT        = LVN_ENDLABELEDITA;
  2012.  
  2013. const
  2014.   LVN_GETDISPINFOA        = LVN_FIRST-50;
  2015.   LVN_SETDISPINFOA        = LVN_FIRST-51;
  2016.   LVN_GETDISPINFOW        = LVN_FIRST-77;
  2017.   LVN_SETDISPINFOW        = LVN_FIRST-78;
  2018.   LVN_GETDISPINFO        = LVN_GETDISPINFOA;
  2019.   LVN_SETDISPINFO        = LVN_SETDISPINFOA;
  2020.  
  2021.   LVIF_DI_SETITEM         = $1000;
  2022.  
  2023. type
  2024.   PLVDispInfoA = ^TLVDispInfoA;
  2025.   TLVDispInfoA = packed record
  2026.     hdr: TNMHDR;
  2027.     item: TLVItemA;
  2028.   end;
  2029.   PLVDispInfoW = ^TLVDispInfoW;
  2030.   TLVDispInfoW = packed record
  2031.     hdr: TNMHDR;
  2032.     item: TLVItemW;
  2033.   end;
  2034.   PLVDispInfo = PLVDispInfoA;
  2035.  
  2036. const
  2037.   LVN_KEYDOWN             = LVN_FIRST-55;
  2038.  
  2039. type
  2040.   PLVKeyDown = ^TLVKeyDown;
  2041.   TLVKeyDown = packed record
  2042.     hdr: TNMHDR;
  2043.     wVKey: Word;
  2044.     flags: UINT;
  2045.   end;
  2046.  
  2047. { ====== TREEVIEW CONTROL =================== }
  2048.  
  2049. const
  2050.   WC_TREEVIEW = 'SysTreeView32';
  2051.  
  2052. const
  2053.   TVS_HASBUTTONS          = $0001;
  2054.   TVS_HASLINES            = $0002;
  2055.   TVS_LINESATROOT         = $0004;
  2056.   TVS_EDITLABELS          = $0008;
  2057.   TVS_DISABLEDRAGDROP     = $0010;
  2058.   TVS_SHOWSELALWAYS       = $0020;
  2059.  
  2060. type
  2061.   HTreeItem = ^_TreeItem;
  2062.   _TreeItem = packed record
  2063.   end;
  2064.  
  2065. const
  2066.   TVIF_TEXT               = $0001;
  2067.   TVIF_IMAGE              = $0002;
  2068.   TVIF_PARAM              = $0004;
  2069.   TVIF_STATE              = $0008;
  2070.   TVIF_HANDLE             = $0010;
  2071.   TVIF_SELECTEDIMAGE      = $0020;
  2072.   TVIF_CHILDREN           = $0040;
  2073.  
  2074.   TVIS_FOCUSED            = $0001;
  2075.   TVIS_SELECTED           = $0002;
  2076.   TVIS_CUT                = $0004;
  2077.   TVIS_DROPHILITED        = $0008;
  2078.   TVIS_BOLD               = $0010;
  2079.   TVIS_EXPANDED           = $0020;
  2080.   TVIS_EXPANDEDONCE       = $0040;
  2081.   TVIS_EXPANDPARTIAL      = $0080;
  2082.  
  2083.   TVIS_OVERLAYMASK        = $0F00;
  2084.   TVIS_STATEIMAGEMASK     = $F000;
  2085.   TVIS_USERMASK           = $F000;
  2086.  
  2087.  
  2088. const
  2089.   I_CHILDRENCALLBACK  = -1;
  2090.  
  2091. type
  2092.   PTVItemA = ^TTVItemA;
  2093.   PTVItemW = ^TTVItemW;
  2094.   PTVItem = PTVItemA;
  2095.   TTVItemA = packed record
  2096.     mask: UINT;
  2097.     hItem: HTreeItem;
  2098.     state: UINT;
  2099.     stateMask: UINT;
  2100.     pszText: PAnsiChar;
  2101.     cchTextMax: Integer;
  2102.     iImage: Integer;
  2103.     iSelectedImage: Integer;
  2104.     cChildren: Integer;
  2105.     lParam: LPARAM;
  2106.   end;
  2107.   TTVItemW = packed record
  2108.     mask: UINT;
  2109.     hItem: HTreeItem;
  2110.     state: UINT;
  2111.     stateMask: UINT;
  2112.     pszText: PWideChar;
  2113.     cchTextMax: Integer;
  2114.     iImage: Integer;
  2115.     iSelectedImage: Integer;
  2116.     cChildren: Integer;
  2117.     lParam: LPARAM;
  2118.   end;
  2119.   TTVItem = TTVItemA;
  2120.  
  2121. const
  2122.   TVI_ROOT                = HTreeItem($FFFF0000);
  2123.   TVI_FIRST               = HTreeItem($FFFF0001);
  2124.   TVI_LAST                = HTreeItem($FFFF0002);
  2125.   TVI_SORT                = HTreeItem($FFFF0003);
  2126.  
  2127. type
  2128.   PTVInsertStructA = ^TTVInsertStructA;
  2129.   PTVInsertStructW = ^TTVInsertStructW;
  2130.   PTVInsertStruct = PTVInsertStructA;
  2131.   TTVInsertStructA = packed record
  2132.     hParent: HTreeItem;
  2133.     hInsertAfter: HTreeItem;
  2134.     item: TTVItemA;
  2135.   end;
  2136.   TTVInsertStructW = packed record
  2137.     hParent: HTreeItem;
  2138.     hInsertAfter: HTreeItem;
  2139.     item: TTVItemW;
  2140.   end;
  2141.   TTVInsertStruct = TTVInsertStructA;
  2142.  
  2143. const
  2144.   TVM_INSERTITEMA          = TV_FIRST + 0;
  2145.   TVM_INSERTITEMW          = TV_FIRST + 50;
  2146.   TVM_INSERTITEM          = TVM_INSERTITEMA;
  2147.  
  2148. function TreeView_InsertItem(hwnd: HWND; const lpis: TTVInsertStruct): HTreeItem;
  2149.  
  2150. const
  2151.   TVM_DELETEITEM          = TV_FIRST + 1;
  2152.  
  2153. function TreeView_DeleteItem(hwnd: HWND; hitem: HTreeItem): Bool;
  2154.  
  2155. function TreeView_DeleteAllItems(hwnd: HWND): Bool;
  2156.  
  2157. const
  2158.   TVM_EXPAND              = TV_FIRST + 2;
  2159.  
  2160. function TreeView_Expand(hwnd: HWND; hitem: HTreeItem; code: Integer): Bool;
  2161.  
  2162. const
  2163.   TVE_COLLAPSE            = $0001;
  2164.   TVE_EXPAND              = $0002;
  2165.   TVE_TOGGLE              = $0003;
  2166.   TVE_EXPANDPARTIAL       = $4000;
  2167.   TVE_COLLAPSERESET       = $8000;
  2168.  
  2169. const
  2170.   TVM_GETITEMRECT         = TV_FIRST + 4;
  2171.  
  2172. function TreeView_GetItemRect(hwnd: HWND; hitem: HTreeItem;
  2173.   var prc: TRect; code: Bool): Bool;
  2174.  
  2175. const
  2176.   TVM_GETCOUNT            = TV_FIRST + 5;
  2177.  
  2178. function TreeView_GetCount(hwnd: HWND): UINT;
  2179.  
  2180. const
  2181.   TVM_GETINDENT           = TV_FIRST + 6;
  2182.  
  2183. function TreeView_GetIndent(hwnd: HWND): UINT;
  2184.  
  2185. const
  2186.   TVM_SETINDENT           = TV_FIRST + 7;
  2187.  
  2188. function TreeView_SetIndent(hwnd: HWND; indent: Integer): Bool;
  2189.  
  2190. const
  2191.   TVM_GETIMAGELIST        = TV_FIRST + 8;
  2192.  
  2193. function TreeView_GetImageList(hwnd: HWND; iImage: Integer): HImageList;
  2194.  
  2195. const
  2196.   TVSIL_NORMAL            = 0;
  2197.   TVSIL_STATE             = 2;
  2198.  
  2199.  
  2200. const
  2201.   TVM_SETIMAGELIST        = TV_FIRST + 9;
  2202.  
  2203. function TreeView_SetImageList(hwnd: HWND; himl: HImageList;
  2204.   iImage: Integer): HImageList;
  2205.  
  2206. const
  2207.   TVM_GETNEXTITEM         = TV_FIRST + 10;
  2208.  
  2209. function TreeView_GetNextItem(hwnd: HWND; hitem: HTreeItem;
  2210.   code: Integer): HTreeItem;
  2211.  
  2212. const
  2213.   TVGN_ROOT               = $0000;
  2214.   TVGN_NEXT               = $0001;
  2215.   TVGN_PREVIOUS           = $0002;
  2216.   TVGN_PARENT             = $0003;
  2217.   TVGN_CHILD              = $0004;
  2218.   TVGN_FIRSTVISIBLE       = $0005;
  2219.   TVGN_NEXTVISIBLE        = $0006;
  2220.   TVGN_PREVIOUSVISIBLE    = $0007;
  2221.   TVGN_DROPHILITE         = $0008;
  2222.   TVGN_CARET              = $0009;
  2223.  
  2224. function TreeView_GetChild(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2225. function TreeView_GetNextSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2226. function TreeView_GetPrevSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2227. function TreeView_GetParent(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2228. function TreeView_GetFirstVisible(hwnd: HWND): HTreeItem;
  2229. function TreeView_GetNextVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2230. function TreeView_GetPrevVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2231. function TreeView_GetSelection(hwnd: HWND): HTreeItem;
  2232. function TreeView_GetDropHilite(hwnd: HWND): HTreeItem;
  2233. function TreeView_GetRoot(hwnd: HWND): HTreeItem;
  2234.  
  2235. const
  2236.   TVM_SELECTITEM          = TV_FIRST + 11;
  2237.  
  2238. function TreeView_Select(hwnd: HWND; hitem: HTreeItem;
  2239.   code: Integer): HTreeItem;
  2240.  
  2241. function TreeView_SelectItem(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2242. function TreeView_SelectDropTarget(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2243. function TreeView_SelectSetFirstVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  2244.  
  2245. const
  2246.   TVM_GETITEMA             = TV_FIRST + 12;
  2247.   TVM_GETITEMW             = TV_FIRST + 62;
  2248.   TVM_GETITEM             = TVM_GETITEMA;
  2249.  
  2250. function TreeView_GetItemA(hwnd: HWND; var pitem: TTVItemA): Bool;
  2251. function TreeView_GetItemW(hwnd: HWND; var pitem: TTVItemW): Bool;
  2252. function TreeView_GetItem(hwnd: HWND; var pitem: TTVItem): Bool;
  2253.  
  2254. const
  2255.   TVM_SETITEMA             = TV_FIRST + 13;
  2256.   TVM_SETITEMW             = TV_FIRST + 63;
  2257.   TVM_SETITEM             = TVM_SETITEMA;
  2258.  
  2259. function TreeView_SetItemA(hwnd: HWND; const pitem: TTVItemA): Bool;
  2260. function TreeView_SetItemW(hwnd: HWND; const pitem: TTVItemW): Bool;
  2261. function TreeView_SetItem(hwnd: HWND; const pitem: TTVItem): Bool;
  2262.  
  2263. const
  2264.   TVM_EDITLABELA           = TV_FIRST + 14;
  2265.   TVM_EDITLABELW           = TV_FIRST + 65;
  2266.   TVM_EDITLABEL           = TVM_EDITLABELA;
  2267.  
  2268. function TreeView_EditLabelA(hwnd: HWND; hitem: HTreeItem): HWND;
  2269. function TreeView_EditLabelW(hwnd: HWND; hitem: HTreeItem): HWND;
  2270. function TreeView_EditLabel(hwnd: HWND; hitem: HTreeItem): HWND;
  2271.  
  2272. const
  2273.   TVM_GETEDITCONTROL      = TV_FIRST + 15;
  2274.  
  2275. function TreeView_GetEditControl(hwnd: HWND): HWND;
  2276.  
  2277.  
  2278. const
  2279.   TVM_GETVISIBLECOUNT     = TV_FIRST + 16;
  2280.  
  2281. function TreeView_GetVisibleCount(hwnd: HWND): UINT;
  2282.  
  2283. const
  2284.   TVM_HITTEST             = TV_FIRST + 17;
  2285.  
  2286. type
  2287.   PTVHitTestInfo = ^TTVHitTestInfo;
  2288.   TTVHitTestInfo = packed record
  2289.     pt: TPoint;
  2290.     flags: UINT;
  2291.     hItem: HTreeItem;
  2292.   end;
  2293.  
  2294. function TreeView_HitTest(hwnd: HWND; var lpht: TTVHitTestInfo): HTreeItem;
  2295.  
  2296. const
  2297.   TVHT_NOWHERE            = $0001;
  2298.   TVHT_ONITEMICON         = $0002;
  2299.   TVHT_ONITEMLABEL        = $0004;
  2300.   TVHT_ONITEMINDENT       = $0008;
  2301.   TVHT_ONITEMBUTTON       = $0010;
  2302.   TVHT_ONITEMRIGHT        = $0020;
  2303.   TVHT_ONITEMSTATEICON    = $0040;
  2304.  
  2305.   TVHT_ONITEM             = TVHT_ONITEMICON or TVHT_ONITEMLABEL or
  2306.                   TVHT_ONITEMSTATEICON;
  2307.  
  2308.   TVHT_ABOVE              = $0100;
  2309.   TVHT_BELOW              = $0200;
  2310.   TVHT_TORIGHT            = $0400;
  2311.   TVHT_TOLEFT             = $0800;
  2312.  
  2313. const
  2314.   TVM_CREATEDRAGIMAGE     = TV_FIRST + 18;
  2315.  
  2316. function TreeView_CreateDragImage(hwnd: HWND; hitem: HTreeItem): HimageList;
  2317.  
  2318. const
  2319.   TVM_SORTCHILDREN        = TV_FIRST + 19;
  2320.  
  2321. function TreeView_SortChildren(hwnd: HWND; hitem: HTreeItem;
  2322.   recurse: Integer): Bool;
  2323.  
  2324. const
  2325.   TVM_ENSUREVISIBLE       = TV_FIRST + 20;
  2326.  
  2327. function TreeView_EnsureVisible(hwnd: HWND; hitem: HTreeItem): Bool;
  2328.  
  2329. const
  2330.   TVM_SORTCHILDRENCB      = TV_FIRST + 21;
  2331.  
  2332. type
  2333.   TTVCompare = function(lParam1, lParam2, lParamSort: Longint): Integer stdcall;
  2334.  
  2335. type
  2336.   TTVSortCB = packed record
  2337.     hParent: HTreeItem;
  2338.     lpfnCompare: TTVCompare;
  2339.     lParam: LPARAM;
  2340.   end;
  2341.  
  2342. function TreeView_SortChildrenCB(hwnd: HWND; const psort: TTVSortCB;
  2343.   recurse: Integer): Bool;
  2344.  
  2345. const
  2346.   TVM_ENDEDITLABELNOW     = TV_FIRST + 22;
  2347.  
  2348. function TreeView_EndEditLabelNow(hwnd: HWND; fCancel: Bool): Bool;
  2349.  
  2350. const
  2351.   TVM_GETISEARCHSTRINGA    = TV_FIRST + 23;
  2352.   TVM_GETISEARCHSTRINGW    = TV_FIRST + 64;
  2353.   TVM_GETISEARCHSTRING    = TVM_GETISEARCHSTRINGA;
  2354.  
  2355. function TreeView_GetISearchStringA(hwndTV: HWND; lpsz: PAnsiChar): Bool;
  2356. function TreeView_GetISearchStringW(hwndTV: HWND; lpsz: PWideChar): Bool;
  2357. function TreeView_GetISearchString(hwndTV: HWND; lpsz: PChar): Bool;
  2358.  
  2359. type
  2360.   PNMTreeViewA = ^TNMTreeViewA;
  2361.   PNMTreeViewW = ^TNMTreeViewW;
  2362.   PNMTreeView = PNMTreeViewA;
  2363.   TNMTreeViewA = packed record
  2364.     hdr: TNMHDR;
  2365.     action: UINT;
  2366.     itemOld: TTVItemA;
  2367.     itemNew: TTVItemA;
  2368.     ptDrag: TPoint;
  2369.   end;
  2370.   TNMTreeViewW = packed record
  2371.     hdr: TNMHDR;
  2372.     action: UINT;
  2373.     itemOld: TTVItemW;
  2374.     itemNew: TTVItemW;
  2375.     ptDrag: TPoint;
  2376.   end;
  2377.   TNMTreeView = TNMTreeViewA;
  2378.  
  2379. const
  2380.   TVN_SELCHANGINGA         = TVN_FIRST-1;
  2381.   TVN_SELCHANGEDA          = TVN_FIRST-2;
  2382.   TVN_SELCHANGINGW         = TVN_FIRST-50;
  2383.   TVN_SELCHANGEDW          = TVN_FIRST-51;
  2384.   TVN_SELCHANGING         = TVN_SELCHANGINGA;
  2385.   TVN_SELCHANGED          = TVN_SELCHANGEDA;
  2386.  
  2387. const
  2388.   TVC_UNKNOWN             = $0000;
  2389.   TVC_BYMOUSE             = $0001;
  2390.   TVC_BYKEYBOARD          = $0002;
  2391.  
  2392. const
  2393.   TVN_GETDISPINFOA         = TVN_FIRST-3;
  2394.   TVN_SETDISPINFOA         = TVN_FIRST-4;
  2395.   TVN_GETDISPINFOW         = TVN_FIRST-52;
  2396.   TVN_SETDISPINFOW         = TVN_FIRST-53;
  2397.   TVN_GETDISPINFO         = TVN_GETDISPINFOA;
  2398.   TVN_SETDISPINFO         = TVN_SETDISPINFOA;
  2399.  
  2400.   TVIF_DI_SETITEM         = $1000;
  2401.  
  2402. type
  2403.   PTVDispInfoA = ^TTVDispInfoA;
  2404.   PTVDispInfoW = ^TTVDispInfoW;
  2405.   PTVDispInfo = PTVDispInfoA;
  2406.   TTVDispInfoA = packed record
  2407.     hdr: TNMHDR;
  2408.     item: TTVItemA;
  2409.   end;
  2410.   TTVDispInfoW = packed record
  2411.     hdr: TNMHDR;
  2412.     item: TTVItemW;
  2413.   end;
  2414.   TTVDispInfo = TTVDispInfoA;
  2415.  
  2416. const
  2417.   TVN_ITEMEXPANDINGA       = TVN_FIRST-5;
  2418.   TVN_ITEMEXPANDEDA        = TVN_FIRST-6;
  2419.   TVN_BEGINDRAGA           = TVN_FIRST-7;
  2420.   TVN_BEGINRDRAGA          = TVN_FIRST-8;
  2421.   TVN_DELETEITEMA          = TVN_FIRST-9;
  2422.   TVN_BEGINLABELEDITA      = TVN_FIRST-10;
  2423.   TVN_ENDLABELEDITA        = TVN_FIRST-11;
  2424.   TVN_ITEMEXPANDINGW       = TVN_FIRST-54;
  2425.   TVN_ITEMEXPANDEDW        = TVN_FIRST-55;
  2426.   TVN_BEGINDRAGW           = TVN_FIRST-56;
  2427.   TVN_BEGINRDRAGW          = TVN_FIRST-57;
  2428.   TVN_DELETEITEMW          = TVN_FIRST-58;
  2429.   TVN_BEGINLABELEDITW      = TVN_FIRST-59;
  2430.   TVN_ENDLABELEDITW        = TVN_FIRST-60;
  2431.   TVN_ITEMEXPANDING       = TVN_ITEMEXPANDINGA;
  2432.   TVN_ITEMEXPANDED        = TVN_ITEMEXPANDEDA;
  2433.   TVN_BEGINDRAG           = TVN_BEGINDRAGA;
  2434.   TVN_BEGINRDRAG          = TVN_BEGINRDRAGA;
  2435.   TVN_DELETEITEM          = TVN_DELETEITEMA;
  2436.   TVN_BEGINLABELEDIT      = TVN_BEGINLABELEDITA;
  2437.   TVN_ENDLABELEDIT        = TVN_ENDLABELEDITA;
  2438.  
  2439. const
  2440.   TVN_KEYDOWN             = TVN_FIRST-12;
  2441.  
  2442. type
  2443.   TTVKeyDown = packed record
  2444.     hdr: TNMHDR;
  2445.     wVKey: Word;
  2446.     flags: UINT;
  2447.   end;
  2448.  
  2449.  
  2450. { ====== TAB CONTROL ======================== }
  2451.  
  2452. const
  2453.   WC_TABCONTROL = 'SysTabControl32';
  2454.  
  2455. const
  2456.   TCS_SCROLLOPPOSITE    = $0001;
  2457.   TCS_BOTTOM            = $0002;
  2458.   TCS_RIGHT             = $0002;
  2459.   TCS_FORCEICONLEFT     = $0010;
  2460.   TCS_FORCELABELLEFT    = $0020;
  2461.   TCS_HOTTRACK          = $0040;
  2462.   TCS_VERTICAL          = $0080;
  2463.   TCS_TABS              = $0000;
  2464.   TCS_BUTTONS           = $0100;
  2465.   TCS_SINGLELINE        = $0000;
  2466.   TCS_MULTILINE         = $0200;
  2467.   TCS_RIGHTJUSTIFY      = $0000;
  2468.   TCS_FIXEDWIDTH        = $0400;
  2469.   TCS_RAGGEDRIGHT       = $0800;
  2470.   TCS_FOCUSONBUTTONDOWN = $1000;
  2471.   TCS_OWNERDRAWFIXED    = $2000;
  2472.   TCS_TOOLTIPS          = $4000;
  2473.   TCS_FOCUSNEVER        = $8000;
  2474.  
  2475. const
  2476.   TCM_FIRST              = $1300;
  2477.   TCM_GETIMAGELIST       = TCM_FIRST + 2;
  2478.   TCM_SETIMAGELIST       = TCM_FIRST + 3;
  2479.   TCM_GETITEMCOUNT       = TCM_FIRST + 4;
  2480.   TCM_DELETEITEM         = TCM_FIRST + 8;
  2481.   TCM_DELETEALLITEMS     = TCM_FIRST + 9;
  2482.   TCM_GETITEMRECT        = TCM_FIRST + 10;
  2483.   TCM_GETCURSEL          = TCM_FIRST + 11;
  2484.   TCM_SETCURSEL          = TCM_FIRST + 12;
  2485.   TCM_HITTEST            = TCM_FIRST + 13;
  2486.   TCM_SETITEMEXTRA       = TCM_FIRST + 14;
  2487.   TCM_ADJUSTRECT         = TCM_FIRST + 40;
  2488.   TCM_SETITEMSIZE        = TCM_FIRST + 41;
  2489.   TCM_REMOVEIMAGE        = TCM_FIRST + 42;
  2490.   TCM_SETPADDING         = TCM_FIRST + 43;
  2491.   TCM_GETROWCOUNT        = TCM_FIRST + 44;
  2492.   TCM_GETTOOLTIPS        = TCM_FIRST + 45;
  2493.   TCM_SETTOOLTIPS        = TCM_FIRST + 46;
  2494.   TCM_GETCURFOCUS        = TCM_FIRST + 47;
  2495.   TCM_SETCURFOCUS        = TCM_FIRST + 48;
  2496.  
  2497. const
  2498.   TCIF_TEXT  = $0001;
  2499.   TCIF_IMAGE = $0002;
  2500.   TCIF_RTLREADING = $0004; 
  2501.   TCIF_PARAM = $0008;
  2502.  
  2503. type
  2504.   PTCItemHeaderA = ^TTCItemHeaderA;
  2505.   PTCItemHeaderW = ^TTCItemHeaderW;
  2506.   PTCItemHeader = PTCItemHeaderA;
  2507.   TTCItemHeaderA = packed record
  2508.     mask: UINT;
  2509.     lpReserved1: UINT;
  2510.     lpReserved2: UINT;
  2511.     pszText: PAnsiChar;
  2512.     cchTextMax: Integer;
  2513.     iImage: Integer;
  2514.   end;
  2515.   TTCItemHeaderW = packed record
  2516.     mask: UINT;
  2517.     lpReserved1: UINT;
  2518.     lpReserved2: UINT;
  2519.     pszText: PWideChar;
  2520.     cchTextMax: Integer;
  2521.     iImage: Integer;
  2522.   end;
  2523.   TTCItemHeader = TTCItemHeaderA;
  2524.  
  2525.   PTCItemA = ^TTCItemA;
  2526.   PTCItemW = ^TTCItemW;
  2527.   PTCItem = PTCItemA;
  2528.   TTCItemA = packed record
  2529.     mask: UINT;
  2530.     lpReserved1: UINT;
  2531.     lpReserved2: UINT;
  2532.     pszText: PAnsiChar;
  2533.     cchTextMax: Integer;
  2534.     iImage: Integer;
  2535.     lParam: LPARAM;
  2536.   end;
  2537.   TTCItemW = packed record
  2538.     mask: UINT;
  2539.     lpReserved1: UINT;
  2540.     lpReserved2: UINT;
  2541.     pszText: PWideChar;
  2542.     cchTextMax: Integer;
  2543.     iImage: Integer;
  2544.     lParam: LPARAM;
  2545.   end;
  2546.   TTCItem = TTCItemA;
  2547.  
  2548. const
  2549.   TCM_GETITEMA             = TCM_FIRST + 5;
  2550.   TCM_SETITEMA             = TCM_FIRST + 6;
  2551.   TCM_INSERTITEMA          = TCM_FIRST + 7;
  2552.   TCM_GETITEMW             = TCM_FIRST + 60;
  2553.   TCM_SETITEMW             = TCM_FIRST + 61;
  2554.   TCM_INSERTITEMW          = TCM_FIRST + 62;
  2555.   TCM_GETITEM             = TCM_GETITEMA;
  2556.   TCM_SETITEM             = TCM_SETITEMA;
  2557.   TCM_INSERTITEM          = TCM_INSERTITEMA;
  2558.  
  2559. const
  2560.   TCHT_NOWHERE     = $0001;
  2561.   TCHT_ONITEMICON  = $0002;
  2562.   TCHT_ONITEMLABEL = $0004;
  2563.   TCHT_ONITEM      = TCHT_ONITEMICON or TCHT_ONITEMLABEL;
  2564.  
  2565. type
  2566.   PTCHitTestInfo = ^TTCHitTestInfo;
  2567.   TTCHitTestInfo = packed record
  2568.     pt: TPoint;
  2569.     flags: UINT;
  2570.   end;
  2571.  
  2572.   TTCKeyDown = packed record
  2573.     hdr: TNMHDR;
  2574.     wVKey: Word;
  2575.     flags: UINT;
  2576.   end;
  2577.  
  2578. const
  2579.   TCN_KEYDOWN             = TCN_FIRST - 0;
  2580.   TCN_SELCHANGE           = TCN_FIRST - 1;
  2581.   TCN_SELCHANGING         = TCN_FIRST - 2;
  2582.  
  2583.  
  2584. { ====== ANIMATE CONTROL ================= }
  2585.  
  2586. const
  2587.   ANIMATE_CLASS = 'SysAnimate32';
  2588.  
  2589. const
  2590.   ACS_CENTER              = $0001;
  2591.   ACS_TRANSPARENT         = $0002;
  2592.   ACS_AUTOPLAY            = $0004;
  2593.   ACS_TIMER               = $0008;  { don't use threads... use timers }
  2594.  
  2595.   ACM_OPENA                = WM_USER + 100;
  2596.   ACM_OPENW                = WM_USER + 103;
  2597.   ACM_OPEN                = ACM_OPENA;
  2598.  
  2599.   ACM_PLAY                = WM_USER + 101;
  2600.   ACM_STOP                = WM_USER + 102;
  2601.  
  2602.   ACN_START               = 1;
  2603.   ACN_STOP                = 2;
  2604.  
  2605. { ====== MONTHCAL CONTROL ========= }
  2606.  
  2607. const
  2608.   MONTHCAL_CLASS          = 'SysMonthCal32';
  2609.  
  2610.   // Message constants
  2611.   MCM_FIRST             = $1000;
  2612.   MCM_GETCURSEL         = MCM_FIRST + 1;
  2613.   MCM_SETCURSEL         = MCM_FIRST + 2;
  2614.   MCM_GETMAXSELCOUNT    = MCM_FIRST + 3;
  2615.   MCM_SETMAXSELCOUNT    = MCM_FIRST + 4;
  2616.   MCM_GETSELRANGE       = MCM_FIRST + 5;
  2617.   MCM_SETSELRANGE       = MCM_FIRST + 6;
  2618.   MCM_GETMONTHRANGE     = MCM_FIRST + 7;
  2619.   MCM_SETDAYSTATE       = MCM_FIRST + 8;
  2620.   MCM_GETMINREQRECT     = MCM_FIRST + 9;
  2621.   MCM_SETCOLOR          = MCM_FIRST + 10;
  2622.   MCM_GETCOLOR          = MCM_FIRST + 11;
  2623.   MCM_SETTODAY          = MCM_FIRST + 12;
  2624.   MCM_GETTODAY          = MCM_FIRST + 13;
  2625.   MCM_HITTEST           = MCM_FIRST + 14;
  2626.   MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15;
  2627.   MCM_GETFIRSTDAYOFWEEK = MCM_FIRST + 16;
  2628.   MCM_GETRANGE          = MCM_FIRST + 17;
  2629.   MCM_SETRANGE          = MCM_FIRST + 18;
  2630.   MCM_GETMONTHDELTA     = MCM_FIRST + 19;
  2631.   MCM_SETMONTHDELTA     = MCM_FIRST + 20;
  2632.  
  2633.   // Hit test flags
  2634.   MCHT_TITLE            = $00010000;
  2635.   MCHT_CALENDAR         = $00020000;
  2636.   MCHT_TODAYLINK        = $00030000;
  2637.   MCHT_NEXT             = $01000000;  // these indicate that hitting
  2638.   MCHT_PREV             = $02000000;  // here will go to the next/prev month
  2639.   MCHT_NOWHERE          = $00000000;
  2640.   MCHT_TITLEBK          = MCHT_TITLE;
  2641.   MCHT_TITLEMONTH       = MCHT_TITLE or $0001;
  2642.   MCHT_TITLEYEAR        = MCHT_TITLE or $0002;
  2643.   MCHT_TITLEBTNNEXT     = MCHT_TITLE or MCHT_NEXT or $0003;
  2644.   MCHT_TITLEBTNPREV     = MCHT_TITLE or MCHT_PREV or $0003;
  2645.   MCHT_CALENDARBK       = MCHT_CALENDAR;
  2646.   MCHT_CALENDARDATE     = MCHT_CALENDAR or $0001;
  2647.   MCHT_CALENDARDATENEXT = MCHT_CALENDARDATE or MCHT_NEXT;
  2648.   MCHT_CALENDARDATEPREV = MCHT_CALENDARDATE or MCHT_PREV;
  2649.   MCHT_CALENDARDAY      = MCHT_CALENDAR or $0002;
  2650.   MCHT_CALENDARWEEKNUM  = MCHT_CALENDAR or $0003;
  2651.  
  2652.   // Color codes
  2653.   MCSC_BACKGROUND       = 0;   // the background color (between months)
  2654.   MCSC_TEXT             = 1;   // the dates
  2655.   MCSC_TITLEBK          = 2;   // background of the title
  2656.   MCSC_TITLETEXT        = 3;
  2657.   MCSC_MONTHBK          = 4;   // background within the month cal
  2658.   MCSC_TRAILINGTEXT     = 5;   // the text color of header & trailing days
  2659.  
  2660.   // Notification codes
  2661.   MCN_SELCHANGE         = MCN_FIRST + 1;
  2662.   MCN_GETDAYSTATE       = MCN_FIRST + 3;
  2663.   MCN_SELECT            = MCN_FIRST + 4;
  2664.  
  2665.   // Style flags
  2666.   MCS_DAYSTATE          = $0001;
  2667.   MCS_MULTISELECT       = $0002;
  2668.   MCS_WEEKNUMBERS       = $0004;
  2669.   MCS_NOTODAY           = $0008;
  2670.  
  2671.   GMR_VISIBLE           = 0;       // visible portion of display
  2672.   GMR_DAYSTATE          = 1;       // above plus the grayed out parts of
  2673.                    // partially displayed months
  2674.  
  2675. type
  2676.   // bit-packed array of "bold" info for a month
  2677.   // if a bit is on, that day is drawn bold
  2678.   PMonthDayState = ^TMonthDayState;
  2679.   TMonthDayState = DWORD;
  2680.  
  2681.   PMCHitTestInfo = ^TMCHitTestInfo;
  2682.   TMCHitTestInfo = packed record
  2683.     cbSize: UINT;
  2684.     pt: TPoint;
  2685.     uHit: UINT;      // out param
  2686.     st: TSystemTime;
  2687.   end;
  2688.  
  2689.   // MCN_SELCHANGE is sent whenever the currently displayed date changes
  2690.   // via month change, year change, keyboard navigation, prev/next button
  2691.   PNMSelChange = ^TNMSelChange;
  2692.   TNMSelChange = packed record
  2693.     nmhdr: TNmHdr;  // this must be first, so we don't break WM_NOTIFY
  2694.     stSelStart: TSystemTime;
  2695.     stSelEnd: TSystemTime;
  2696.   end;
  2697.  
  2698.   // MCN_GETDAYSTATE is sent for MCS_DAYSTATE controls whenever new daystate
  2699.   // information is needed (month or year scroll) to draw bolding information.
  2700.   // The app must fill in cDayState months worth of information starting from
  2701.   // stStart date. The app may fill in the array at prgDayState or change
  2702.   // prgDayState to point to a different array out of which the information
  2703.   // will be copied. (similar to tooltips)
  2704.   PNMDayState = ^TNMDayState;
  2705.   TNMDayState = packed record
  2706.     nmhdr: TNmHdr;  // this must be first, so we don't break WM_NOTIFY
  2707.     stStart: TSystemTime;
  2708.     cDayState: Integer;
  2709.     prgDayState: PMonthDayState; // points to cDayState TMONTHDAYSTATEs
  2710.   end;
  2711.  
  2712.   // MCN_SELECT is sent whenever a selection has occured (via mouse or keyboard)
  2713.   PNMSelect = ^TNMSelect;
  2714.   TNMSelect = TNMSelChange;
  2715.  
  2716. //   returns FALSE if MCS_MULTISELECT
  2717. //   returns TRUE and sets *pst to the currently selected date otherwise
  2718. function MonthCal_GetCurSel(hmc: HWND; var pst: TSystemTime): BOOL;
  2719.  
  2720. //   returns FALSE if MCS_MULTISELECT
  2721. //   returns TURE and sets the currently selected date to *pst otherwise
  2722. function MonthCal_SetCurSel(hmc: HWND; const pst: TSystemTime): BOOL;
  2723.  
  2724. //   returns the maximum number of selectable days allowed
  2725. function MonthCal_GetMaxSelCount(hmc: HWND): DWORD;
  2726.  
  2727. //   sets the max number days that can be selected iff MCS_MULTISELECT
  2728. function MonthCal_SetMaxSelCount(hmc: HWND; n: UINT): BOOL;
  2729.  
  2730. //   sets rgst[0] to the first day of the selection range
  2731. //   sets rgst[1] to the last day of the selection range
  2732. function MonthCal_GetSelRange(hmc: HWND; rgst: PSystemTime): BOOL;
  2733.  
  2734. //   selects the range of days from rgst[0] to rgst[1]
  2735. function MonthCal_SetSelRange(hmc: HWND; rgst: PSystemTime): BOOL;
  2736.  
  2737. //   if rgst specified, sets rgst[0] to the starting date and
  2738. //      and rgst[1] to the ending date of the the selectable (non-grayed)
  2739. //      days if GMR_VISIBLE or all the displayed days (including grayed)
  2740. //      if GMR_DAYSTATE.
  2741. //   returns the number of months spanned by the above range.
  2742. function MonthCal_GetMonthRange(hmc: HWND; gmr: DWORD; rgst: PSystemTime): DWORD;
  2743.  
  2744. //   cbds is the count of DAYSTATE items in rgds and it must be equal
  2745. //   to the value returned from MonthCal_GetMonthRange(hmc, GMR_DAYSTATE, NULL)
  2746. //   This sets the DAYSTATE bits for each month (grayed and non-grayed
  2747. //   days) displayed in the calendar. The first bit in a month's DAYSTATE
  2748. //   corresponts to bolding day 1, the second bit affects day 2, etc.
  2749. function MonthCal_SetDayState(hmc: HWND; cbds: Integer; const rgds: TNMDayState): BOOL;
  2750.  
  2751. //   sets prc the minimal size needed to display one month
  2752. function MonthCal_GetMinReqRect(hmc: HWND; var prc: TRect): BOOL;
  2753.  
  2754. // set what day is "today"   send NULL to revert back to real date
  2755. function MonthCal_SetToday(hmc: HWND; const pst: TSystemTime): BOOL;
  2756.  
  2757. // get what day is "today"
  2758. // returns BOOL for success/failure
  2759. function MonthCal_GetToday(hmc: HWND; var pst: TSystemTime): BOOL;
  2760.  
  2761. // determine what pinfo->pt is over
  2762. function MonthCal_HitTest(hmc: HWND; var info: TMCHitTestInfo): DWORD;
  2763.  
  2764. // set colors to draw control with -- see MCSC_ bits below
  2765. function MonthCal_SetColor(hmc: HWND; iColor: Integer; clr: TColorRef): BOOL;
  2766.  
  2767. function MonthCal_GetColor(hmc: HWND; iColor: Integer): TColorRef;
  2768.  
  2769. // set first day of week to iDay:
  2770. // 0 for Monday, 1 for Tuesday, ..., 6 for Sunday
  2771. // -1 for means use locale info
  2772. function MonthCal_SetFirstDayOfWeek(hmc: HWND; iDay: Integer): BOOL;
  2773.  
  2774. // DWORD result...  low word has the day.  high word is bool if this is app set
  2775. // or not (FALSE == using locale info)
  2776. function MonthCal_GetFirstDayOfWeek(hmc: HWND): Integer;
  2777.  
  2778. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  2779. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  2780. //   returns GDTR_MIN|GDTR_MAX if there is a minimum|maximum limit
  2781. function MonthCal_GetRange(hmc: HWND; rgst: PSystemTime): DWORD;
  2782.  
  2783. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  2784. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  2785. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  2786. function Monthcal_SetRange(hmc: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL;
  2787.  
  2788. //   returns the number of months one click on a next/prev button moves by
  2789. function MonthCal_GetMonthDelta(hmc: HWND): Integer;
  2790.  
  2791. //   sets the month delta to n. n = 0 reverts to moving by a page of months
  2792. //   returns the previous value of n.
  2793. function MonthCal_SetMonthDelta(hmc: HWND; n: Integer): Integer;
  2794.  
  2795.  
  2796. { ====== DATETIMEPICK CONTROL =============== }
  2797.  
  2798. const
  2799.   DATETIMEPICK_CLASS = 'SysDateTimePick32';
  2800.  
  2801.   // Message constants
  2802.   DTM_FIRST         = $1000;
  2803.   DTM_GETSYSTEMTIME = DTM_FIRST + 1;
  2804.   DTM_SETSYSTEMTIME = DTM_FIRST + 2;
  2805.   DTM_GETRANGE      = DTM_FIRST + 3;
  2806.   DTM_SETRANGE      = DTM_FIRST + 4;
  2807.   DTM_SETFORMATA    = DTM_FIRST + 5;
  2808.   DTM_SETFORMATW    = DTM_FIRST + 50;
  2809.   DTM_SETFORMAT     = DTM_SETFORMATA;
  2810.   DTM_SETMCCOLOR    = DTM_FIRST + 6;
  2811.   DTM_GETMCCOLOR    = DTM_FIRST + 7;
  2812.   DTM_GETMONTHCAL   = DTM_FIRST + 8;
  2813.   DTM_SETMCFONT     = DTM_FIRST + 9;
  2814.   DTM_GETMCFONT     = DTM_FIRST + 10;
  2815.  
  2816.   // Style Flags
  2817.   DTS_UPDOWN          = $0001;  // use UPDOWN instead of MONTHCAL
  2818.   DTS_SHOWNONE        = $0002;  // allow a NONE selection
  2819.   DTS_SHORTDATEFORMAT = $0000;  // use the short date format
  2820.                 // (app must forward WM_WININICHANGE messages)
  2821.   DTS_LONGDATEFORMAT  = $0004;  // use the long date format
  2822.                 // (app must forward WM_WININICHANGE messages)
  2823.   DTS_TIMEFORMAT      = $0009;  // use the time format
  2824.                 // (app must forward WM_WININICHANGE messages)
  2825.   DTS_APPCANPARSE     = $0010;  // allow user entered strings
  2826.                 // (app MUST respond to DTN_USERSTRING)
  2827.   DTS_RIGHTALIGN      = $0020;  // right-align popup instead of left-align it
  2828.  
  2829.   // Notification codes
  2830.   DTN_DATETIMECHANGE = DTN_FIRST + 1;  // the systemtime has changed
  2831.   DTN_USERSTRINGA    = DTN_FIRST + 2;  // the user has entered a string
  2832.   DTN_USERSTRINGW    = DTN_FIRST + 15;
  2833.   DTN_USERSTRING     = DTN_USERSTRINGA;
  2834.   DTN_WMKEYDOWNA     = DTN_FIRST + 3;  // modify keydown on app format field (X)
  2835.   DTN_WMKEYDOWNW     = DTN_FIRST + 16;
  2836.   DTN_WMKEYDOWN      = DTN_WMKEYDOWNA;
  2837.   DTN_FORMATA        = DTN_FIRST + 4;  // query display for app format field (X)
  2838.   DTN_FORMATW        = DTN_FIRST + 17;
  2839.   DTN_FORMAT         = DTN_FORMATA;
  2840.   DTN_FORMATQUERYA   = DTN_FIRST + 5;  // query formatting info for app format field (X)
  2841.   DTN_FORMATQUERYW   = DTN_FIRST + 18;
  2842.   DTN_FORMATQUERY    = DTN_FORMATQUERYA;
  2843.   DTN_DROPDOWN       = DTN_FIRST + 6;  // MonthCal has dropped down
  2844.   DTN_CLOSEUP        = DTN_FIRST + 7;  // MonthCal is popping up
  2845.  
  2846.   // Ranges
  2847.   GDTR_MIN = $0001;
  2848.   GDTR_MAX = $0002;
  2849.  
  2850.   // Return Values
  2851.   GDT_ERROR = -1;
  2852.   GDT_VALID = 0;
  2853.   GDT_NONE  = 1;
  2854.  
  2855. type
  2856.   PNMDateTimeChange = ^TNMDateTimeChange;
  2857.   TNMDateTimeChange = packed record
  2858.     nmhdr: TNmHdr;
  2859.     dwFlags: DWORD;         // GDT_VALID or GDT_NONE
  2860.     st: TSystemTime;        // valid iff dwFlags = GDT_VALID
  2861.   end;
  2862.  
  2863.   PNMDateTimeStringA = ^TNMDateTimeStringA;
  2864.   PNMDateTimeStringW = ^TNMDateTimeStringW;
  2865.   PNMDateTimeString = PNMDateTimeStringA;
  2866.   TNMDateTimeStringA = packed record
  2867.     nmhdr: TNmHdr;
  2868.     pszUserString: PAnsiChar;     // string user entered
  2869.     st: TSystemTime;           // app fills this in
  2870.     dwFlags: DWORD;            // GDT_VALID or GDT_NONE
  2871.   end;
  2872.   TNMDateTimeStringW = packed record
  2873.     nmhdr: TNmHdr;
  2874.     pszUserString: PWideChar;     // string user entered
  2875.     st: TSystemTime;           // app fills this in
  2876.     dwFlags: DWORD;            // GDT_VALID or GDT_NONE
  2877.   end;
  2878.   TNMDateTimeString = TNMDateTimeStringA;
  2879.  
  2880.   PNMDateTimeWMKeyDownA = ^TNMDateTimeWMKeyDownA;
  2881.   PNMDateTimeWMKeyDownW = ^TNMDateTimeWMKeyDownW;
  2882.   PNMDateTimeWMKeyDown = PNMDateTimeWMKeyDownA;
  2883.   TNMDateTimeWMKeyDownA = packed record
  2884.     nmhdr: TNmHdr;
  2885.     nVirtKey: Integer; // virtual key code of WM_KEYDOWN which MODIFIES an X field
  2886.     pszFormat: PAnsiChar; // format substring
  2887.     st: TSystemTime;   // current systemtime, app should modify based on key
  2888.   end;
  2889.   TNMDateTimeWMKeyDownW = packed record
  2890.     nmhdr: TNmHdr;
  2891.     nVirtKey: Integer; // virtual key code of WM_KEYDOWN which MODIFIES an X field
  2892.     pszFormat: PWideChar; // format substring
  2893.     st: TSystemTime;   // current systemtime, app should modify based on key
  2894.   end;
  2895.   TNMDateTimeWMKeyDown = TNMDateTimeWMKeyDownA;
  2896.  
  2897.   PNMDateTimeFormatA = ^TNMDateTimeFormatA;
  2898.   PNMDateTimeFormatW = ^TNMDateTimeFormatW;
  2899.   PNMDateTimeFormat = PNMDateTimeFormatA;
  2900.   TNMDateTimeFormatA = packed record
  2901.     nmhdr: TNmHdr;
  2902.     pszFormat: PAnsiChar;                // format substring
  2903.     st: TSystemTime;                  // current systemtime
  2904.     pszDisplay: PAnsiChar;               // string to display
  2905.     szDisplay: array[0..63] of AnsiChar; // buffer pszDisplay originally points at
  2906.   end;
  2907.   TNMDateTimeFormatW = packed record
  2908.     nmhdr: TNmHdr;
  2909.     pszFormat: PWideChar;                // format substring
  2910.     st: TSystemTime;                  // current systemtime
  2911.     pszDisplay: PWideChar;               // string to display
  2912.     szDisplay: array[0..63] of WideChar; // buffer pszDisplay originally points at
  2913.   end;
  2914.   TNMDateTimeFormat = TNMDateTimeFormatA;
  2915.  
  2916.   PNMDateTimeFormatQueryA = ^TNMDateTimeFormatQueryA;
  2917.   PNMDateTimeFormatQueryW = ^TNMDateTimeFormatQueryW;
  2918.   PNMDateTimeFormatQuery = PNMDateTimeFormatQueryA;
  2919.   TNMDateTimeFormatQueryA = packed record
  2920.     nmhdr: TNmHdr;
  2921.     pszFormat: PAnsiChar; // format substring
  2922.     szMax: TSize;      // max bounding rectangle app will use for this format string
  2923.   end;
  2924.   TNMDateTimeFormatQueryW = packed record
  2925.     nmhdr: TNmHdr;
  2926.     pszFormat: PWideChar; // format substring
  2927.     szMax: TSize;      // max bounding rectangle app will use for this format string
  2928.   end;
  2929.   TNMDateTimeFormatQuery = TNMDateTimeFormatQueryA;
  2930.  
  2931. //   returns GDT_NONE if "none" is selected (DTS_SHOWNONE only)
  2932. //   returns GDT_VALID and modifies pst to be the currently selected value
  2933. function DateTime_GetSystemTime(hdp: HWND; var pst: TSystemTime): DWORD;
  2934.  
  2935. //   if gd = GDT_NONE, sets datetimepick to None (DTS_SHOWNONE only)
  2936. //   if gd = GDT_VALID, sets datetimepick to pst
  2937. //   returns TRUE on success, FALSE on error (such as bad params)
  2938. function DateTime_SetSystemTime(hdp: HWND; gd: DWORD; const pst: TSystemTime): BOOL;
  2939.  
  2940. //   modifies rgst[0] to be the minimum ALLOWABLE systemtime (or 0 if no minimum)
  2941. //   modifies rgst[1] to be the maximum ALLOWABLE systemtime (or 0 if no maximum)
  2942. //   returns GDTR_MIN or GDTR_MAX if there is a minimum or maximum limit
  2943. function DateTime_GetRange(hdp: HWND; rgst: PSystemTime): DWORD;
  2944.  
  2945. //   if GDTR_MIN, sets the minimum ALLOWABLE systemtime to rgst[0], otherwise removes minimum
  2946. //   if GDTR_MAX, sets the maximum ALLOWABLE systemtime to rgst[1], otherwise removes maximum
  2947. //   returns TRUE on success, FALSE on error (such as invalid parameters)
  2948. function DateTime_SetRange(hdp: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL;
  2949.  
  2950. //   sets the display formatting string to sz (see GetDateFormat and GetTimeFormat for valid formatting chars)
  2951. //   NOTE: 'X' is a valid formatting character which indicates that the application
  2952. //   will determine how to display information. Such apps must support DTN_WMKEYDOWN,
  2953. //   DTN_FORMAT, and DTN_FORMATQUERY.
  2954. function DateTime_SetFormatA(hdp: HWND; sz: PAnsiChar): BOOL;
  2955. function DateTime_SetFormatW(hdp: HWND; sz: PWideChar): BOOL;
  2956. function DateTime_SetFormat(hdp: HWND; sz: PChar): BOOL;
  2957.  
  2958. function DateTime_SetMonthCalColor(hdp: HWND; iColor: DWORD; clr: TColorRef): DWORD;
  2959.  
  2960. function DateTime_GetMonthCalColor(hdp: HWND; iColor: DWORD): TColorRef;
  2961.  
  2962. // returns the HWND of the MonthCal popup window. Only valid
  2963. // between DTN_DROPDOWN and DTN_CLOSEUP notifications.
  2964. function DateTime_GetMonthCal(hdp: HWND): HWND;
  2965.  
  2966. function DateTime_SetMonthCalFont(hdp: HWND; Font: HFONT; fRedraw: Boolean): DWORD;
  2967.  
  2968. function DateTime_GetMonthCalFont(hdp: HWND): HFONT;
  2969.  
  2970. implementation
  2971.  
  2972. uses SysUtils;
  2973.  
  2974. const
  2975.   cctrl = 'comctl32.dll';
  2976.  
  2977. var
  2978.   ComCtl32DLL: THandle;
  2979.   _InitCommonControlsEx: function(var ICC: TInitCommonControlsEx): Bool stdcall;
  2980.  
  2981. procedure InitCommonControls; external cctrl name 'InitCommonControls';
  2982.  
  2983. procedure InitComCtl;
  2984. begin
  2985.   if ComCtl32DLL = 0 then begin
  2986.     ComCtl32DLL := GetModuleHandle(cctrl);
  2987.     if (ComCtl32DLL >= 0) and (ComCtl32DLL < 32) then
  2988.       ComCtl32DLL := 0
  2989.     else
  2990.       @_InitCommonControlsEx := GetProcAddress(ComCtl32DLL, 'InitCommonControlsEx');
  2991.   end;
  2992. end;
  2993.  
  2994. function InitCommonControlsEx(var ICC: TInitCommonControlsEx): Bool;
  2995. begin
  2996.   if ComCtl32DLL = 0 then InitComCtl;
  2997.   Result := Assigned(_InitCommonControlsEx) and _InitCommonControlsEx(ICC);
  2998. end;
  2999.  
  3000. { Property Sheets }
  3001. function CreatePropertySheetPageA; external cctrl name 'CreatePropertySheetPageA';
  3002. function CreatePropertySheetPageW; external cctrl name 'CreatePropertySheetPageW';
  3003. function CreatePropertySheetPage; external cctrl name 'CreatePropertySheetPageA';
  3004. function DestroyPropertySheetPage; external cctrl name 'DestroyPropertySheetPage';
  3005. function PropertySheetA; external cctrl name 'PropertySheetA';
  3006. function PropertySheetW; external cctrl name 'PropertySheetW';
  3007. function PropertySheet; external cctrl name 'PropertySheetA';
  3008.  
  3009. { Image List }
  3010. function ImageList_Create; external cctrl name 'ImageList_Create';
  3011. function ImageList_Destroy; external cctrl name 'ImageList_Destroy';
  3012. function ImageList_GetImageCount; external cctrl name 'ImageList_GetImageCount';
  3013. function ImageList_Add; external cctrl name 'ImageList_Add';
  3014. function ImageList_ReplaceIcon; external cctrl name 'ImageList_ReplaceIcon';
  3015. function ImageList_SetBkColor; external cctrl name 'ImageList_SetBkColor';
  3016. function ImageList_GetBkColor; external cctrl name 'ImageList_GetBkColor';
  3017. function ImageList_SetOverlayImage; external cctrl name 'ImageList_SetOverlayImage';
  3018.  
  3019. function ImageList_AddIcon(ImageList: HImageList; Icon: HIcon): Integer;
  3020. begin
  3021.   Result := ImageList_ReplaceIcon(ImageList, -1, Icon);
  3022. end;
  3023.  
  3024. function IndexToOverlayMask(Index: Integer): Integer;
  3025. begin
  3026.   Result := Index shl 8;
  3027. end;
  3028.  
  3029. function ImageList_Draw; external cctrl name 'ImageList_Draw';
  3030.  
  3031. function ImageList_Replace; external cctrl name 'ImageList_Replace';
  3032. function ImageList_AddMasked; external cctrl name 'ImageList_AddMasked';
  3033. function ImageList_DrawEx; external cctrl name 'ImageList_DrawEx';
  3034. function ImageList_Remove; external cctrl name 'ImageList_Remove';
  3035. function ImageList_GetIcon; external cctrl name 'ImageList_GetIcon';
  3036. function ImageList_LoadImageA; external cctrl name 'ImageList_LoadImageA';
  3037. function ImageList_LoadImageW; external cctrl name 'ImageList_LoadImageW';
  3038. function ImageList_LoadImage; external cctrl name 'ImageList_LoadImageA';
  3039. function ImageList_BeginDrag; external cctrl name 'ImageList_BeginDrag';
  3040. function ImageList_EndDrag; external cctrl name 'ImageList_EndDrag';
  3041. function ImageList_DragEnter; external cctrl name 'ImageList_DragEnter';
  3042. function ImageList_DragLeave; external cctrl name 'ImageList_DragLeave';
  3043. function ImageList_DragMove; external cctrl name 'ImageList_DragMove';
  3044. function ImageList_SetDragCursorImage; external cctrl name 'ImageList_SetDragCursorImage';
  3045. function ImageList_DragShowNolock; external cctrl name 'ImageList_DragShowNolock';
  3046. function ImageList_GetDragImage; external cctrl name 'ImageList_GetDragImage';
  3047.  
  3048. { macros }
  3049. procedure ImageList_RemoveAll(ImageList: HImageList);
  3050. begin
  3051.   ImageList_Remove(ImageList, -1);
  3052. end;
  3053.  
  3054. function ImageList_ExtractIcon(Instance: THandle; ImageList: HImageList;
  3055.   Image: Integer): HIcon;
  3056. begin
  3057.   Result := ImageList_GetIcon(ImageList, Image, 0);
  3058. end;
  3059.  
  3060. function ImageList_LoadBitmap(Instance: THandle; Bmp: PChar;
  3061.   CX, Grow: Integer; Mask: TColorRef): HImageList;
  3062. begin
  3063.   Result := ImageList_LoadImage(Instance, Bmp, CX, Grow, Mask,
  3064.     IMAGE_BITMAP, 0);
  3065. end;
  3066.  
  3067. function ImageList_Read; external cctrl name 'ImageList_Read';
  3068. function ImageList_Write; external cctrl name 'ImageList_Write';
  3069.  
  3070. function ImageList_GetIconSize; external cctrl name 'ImageList_GetIconSize';
  3071. function ImageList_SetIconSize; external cctrl name 'ImageList_SetIconSize';
  3072. function ImageList_GetImageInfo; external cctrl name 'ImageList_GetImageInfo';
  3073. function ImageList_Merge; external cctrl name 'ImageList_Merge';
  3074.  
  3075. { Headers }
  3076.  
  3077. function Header_GetItemCount(Header: HWnd): Integer;
  3078. begin
  3079.   Result := SendMessage(Header, HDM_GETITEMCOUNT, 0, 0);
  3080. end;
  3081.  
  3082. function Header_InsertItem(Header: HWnd; Index: Integer;
  3083.   const Item: THDItem): Integer;
  3084. begin
  3085.   Result := SendMessage(Header, HDM_INSERTITEM, Index, Longint(@Item));
  3086. end;
  3087.  
  3088. function Header_DeleteItem(Header: HWnd; Index: Integer): Bool;
  3089. begin
  3090.   Result := Bool( SendMessage(Header, HDM_DELETEITEM, Index, 0) );
  3091. end;
  3092.  
  3093. function Header_GetItem(Header: HWnd; Index: Integer; var Item: THDItem): Bool;
  3094. begin
  3095.   Result := Bool( SendMessage(Header, HDM_GETITEM, Index, Longint(@Item)) );
  3096. end;
  3097.  
  3098. function Header_SetItem(Header: HWnd; Index: Integer; const Item: THDItem): Bool;
  3099. begin
  3100.   Result := Bool( SendMessage(Header, HDM_SETITEM, Index, Longint(@Item)) );
  3101. end;
  3102.  
  3103. function Header_Layout(Header: HWnd; Layout: PHDLayout): Bool;
  3104. begin
  3105.   Result := Bool( SendMessage(Header, HDM_LAYOUT, 0, Longint(Layout)) );
  3106. end;
  3107.  
  3108. { Toolbar }
  3109.  
  3110. function CreateToolBarEx; external cctrl name 'CreateToolbarEx';
  3111. function CreateMappedBitmap; external cctrl name 'CreateMappedBitmap';
  3112.  
  3113. { Status bar }
  3114. procedure DrawStatusTextA; external cctrl name 'DrawStatusTextA';
  3115. procedure DrawStatusTextW; external cctrl name 'DrawStatusTextW';
  3116. procedure DrawStatusText; external cctrl name 'DrawStatusTextA';
  3117. function CreateStatusWindowA; external cctrl name 'CreateStatusWindowA';
  3118. function CreateStatusWindowW; external cctrl name 'CreateStatusWindowW';
  3119. function CreateStatusWindow; external cctrl name 'CreateStatusWindowA';
  3120.  
  3121. { Menu Help }
  3122. procedure MenuHelp; external cctrl name 'MenuHelp';
  3123. function ShowHideMenuCtl; external cctrl name 'ShowHideMenuCtl';
  3124. procedure GetEffectiveClientRect; external cctrl name 'GetEffectiveClientRect';
  3125.  
  3126.  
  3127. { Drag List Box }
  3128. procedure MakeDragList; external cctrl name 'MakeDragList';
  3129. procedure DrawInsert; external cctrl name 'DrawInsert';
  3130. function LBItemFromPt; external cctrl name 'LBItemFromPt';
  3131.  
  3132. { UpDown control }
  3133. function CreateUpDownControl; external cctrl name 'CreateUpDownControl';
  3134.  
  3135.  
  3136. { List View }
  3137. function ListView_GetBkColor(hWnd: HWND): TColorRef;
  3138. begin
  3139.   Result := SendMessage(hWnd, LVM_GETBKCOLOR, 0, 0);
  3140. end;
  3141.  
  3142. function ListView_SetBkColor(hWnd: HWND; clrBk: TColorRef): Bool;
  3143. begin
  3144.   Result := Bool( SendMessage(hWnd, LVM_SETBKCOLOR, 0, clrBk) );
  3145. end;
  3146.  
  3147. function ListView_GetImageList(hWnd: HWND; iImageList: Integer): HImageList;
  3148. begin
  3149.   Result := HImageList( SendMessage(hWnd, LVM_GETIMAGELIST, iImageList, 0) );
  3150. end;
  3151.  
  3152. function ListView_SetImageList(hWnd: HWND; himl: HImageList; iImageList: Integer): HImageList;
  3153. begin
  3154.   Result := HImageList( SendMessage(hWnd, LVM_SETIMAGELIST, iImageList, Longint(himl)) );
  3155. end;
  3156.  
  3157. function ListView_GetItemCount(hWnd: HWND): Integer;
  3158. begin
  3159.   Result := SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0);
  3160. end;
  3161.  
  3162. function IndexToStateImageMask(I: Longint): Longint;
  3163. begin
  3164.   Result := I shl 12;
  3165. end;
  3166.  
  3167. function ListView_GetItemA(hWnd: HWND; var pItem: TLVItemA): Bool;
  3168. begin
  3169.   Result := Bool( SendMessage(hWnd, LVM_GETITEM, 0, Longint(@pItem)) );
  3170. end;
  3171. function ListView_GetItemW(hWnd: HWND; var pItem: TLVItemW): Bool;
  3172. begin
  3173.   Result := Bool( SendMessage(hWnd, LVM_GETITEM, 0, Longint(@pItem)) );
  3174. end;
  3175. function ListView_GetItem(hWnd: HWND; var pItem: TLVItem): Bool;
  3176. begin
  3177.   Result := Bool( SendMessage(hWnd, LVM_GETITEM, 0, Longint(@pItem)) );
  3178. end;
  3179.  
  3180. function ListView_SetItemA(hWnd: HWND; const pItem: TLVItemA): Bool;
  3181. begin
  3182.   Result := Bool( SendMessage(hWnd, LVM_SETITEM, 0, Longint(@pItem)) );
  3183. end;
  3184. function ListView_SetItemW(hWnd: HWND; const pItem: TLVItemW): Bool;
  3185. begin
  3186.   Result := Bool( SendMessage(hWnd, LVM_SETITEM, 0, Longint(@pItem)) );
  3187. end;
  3188. function ListView_SetItem(hWnd: HWND; const pItem: TLVItem): Bool;
  3189. begin
  3190.   Result := Bool( SendMessage(hWnd, LVM_SETITEM, 0, Longint(@pItem)) );
  3191. end;
  3192.  
  3193. function ListView_InsertItemA(hWnd: HWND; const pItem: TLVItemA): Integer;
  3194. begin
  3195.   Result := Integer( SendMessage(hWnd, LVM_INSERTITEM, 0, Longint(@pItem)) );
  3196. end;
  3197. function ListView_InsertItemW(hWnd: HWND; const pItem: TLVItemW): Integer;
  3198. begin
  3199.   Result := Integer( SendMessage(hWnd, LVM_INSERTITEM, 0, Longint(@pItem)) );
  3200. end;
  3201. function ListView_InsertItem(hWnd: HWND; const pItem: TLVItem): Integer;
  3202. begin
  3203.   Result := Integer( SendMessage(hWnd, LVM_INSERTITEM, 0, Longint(@pItem)) );
  3204. end;
  3205.  
  3206. function ListView_DeleteItem(hWnd: HWND; i: Integer): Bool;
  3207. begin
  3208.   Result := Bool( SendMessage(hWnd, LVM_DELETEITEM, i, 0) );
  3209. end;
  3210.  
  3211. function ListView_DeleteAllItems(hWnd: HWND): Bool;
  3212. begin
  3213.   Result := Bool( SendMessage(hWnd, LVM_DELETEALLITEMS, 0, 0) );
  3214. end;
  3215.  
  3216. function ListView_GetCallbackMask(hWnd: HWND): UINT;
  3217. begin
  3218.   Result := SendMessage(hWnd, LVM_GETCALLBACKMASK, 0, 0);
  3219. end;
  3220.  
  3221. function ListView_SetCallbackMask(hWnd: HWND; mask: UINT): Bool;
  3222. begin
  3223.   Result := Bool( SendMessage(hWnd, LVM_SETCALLBACKMASK, mask, 0) );
  3224. end;
  3225.  
  3226. function ListView_GetNextItem(hWnd: HWND; iStart: Integer; Flags: UINT): Integer;
  3227. begin
  3228.   Result := SendMessage(hWnd, LVM_GETNEXTITEM, iStart, MakeLong(Flags, 0));
  3229. end;
  3230.  
  3231. function ListView_FindItemA(hWnd: HWND; iStart: Integer;
  3232.   const plvfi: TLVFindInfoA): Integer;
  3233. begin
  3234.   Result := SendMessage(hWnd, LVM_FINDITEM, iStart, Longint(@plvfi));
  3235. end;
  3236. function ListView_FindItemW(hWnd: HWND; iStart: Integer;
  3237.   const plvfi: TLVFindInfoW): Integer;
  3238. begin
  3239.   Result := SendMessage(hWnd, LVM_FINDITEM, iStart, Longint(@plvfi));
  3240. end;
  3241. function ListView_FindItem(hWnd: HWND; iStart: Integer;
  3242.   const plvfi: TLVFindInfo): Integer;
  3243. begin
  3244.   Result := SendMessage(hWnd, LVM_FINDITEM, iStart, Longint(@plvfi));
  3245. end;
  3246.  
  3247. function ListView_GetItemRect(hWnd: HWND; i: Integer; var prc: TRect;
  3248.   Code: Integer): Bool;
  3249. begin
  3250.   if @prc <> nil then
  3251.   begin
  3252.     prc.left := Code;
  3253.     Result := Bool( SendMessage(hWnd, LVM_GETITEMRECT, i, Longint(@prc)) );
  3254.   end
  3255.   else
  3256.     Result := Bool( SendMessage(hWnd, LVM_GETITEMRECT, i, 0) );
  3257. end;
  3258.  
  3259. function ListView_SetItemPosition(hWnd: HWND; i, x, y: Integer): Bool;
  3260. begin
  3261.   Result := Bool( SendMessage(hWnd, LVM_SETITEMPOSITION, i, MakeLong(x, y)) );
  3262. end;
  3263.  
  3264. function ListView_GetItemPosition(hwndLV: HWND; i: Integer;
  3265.   var ppt: TPoint): Bool;
  3266. begin
  3267.   Result := Bool( SendMessage(hWndLV, LVM_GETITEMPOSITION, i, Longint(@ppt)) );
  3268. end;
  3269.  
  3270. function ListView_GetStringWidthA(hwndLV: HWND; psz: PAnsiChar): Integer;
  3271. begin
  3272.   Result := SendMessage(hwndLV, LVM_GETSTRINGWIDTH, 0, Longint(psz));
  3273. end;
  3274. function ListView_GetStringWidthW(hwndLV: HWND; psz: PWideChar): Integer;
  3275. begin
  3276.   Result := SendMessage(hwndLV, LVM_GETSTRINGWIDTH, 0, Longint(psz));
  3277. end;
  3278. function ListView_GetStringWidth(hwndLV: HWND; psz: PChar): Integer;
  3279. begin
  3280.   Result := SendMessage(hwndLV, LVM_GETSTRINGWIDTH, 0, Longint(psz));
  3281. end;
  3282.  
  3283. function ListView_HitTest(hwndLV: HWND; var pinfo: TLVHitTestInfo): Integer;
  3284. begin
  3285.   Result := SendMessage(hwndLV, LVM_HITTEST, 0, Longint(@pinfo));
  3286. end;
  3287.  
  3288. function ListView_EnsureVisible(hwndLV: HWND; i: Integer; fPartialOK: Bool): Bool;
  3289. begin
  3290.   Result := SendMessage(hwndLV, LVM_ENSUREVISIBLE, i,
  3291.     MakeLong(Integer(fPartialOK), 0)) <> 0;
  3292. end;
  3293.  
  3294. function ListView_Scroll(hwndLV: HWnd; DX, DY: Integer): Bool;
  3295. begin
  3296.   Result := Bool( SendMessage(hwndLV, LVM_SCROLL, DX, DY) );
  3297. end;
  3298.  
  3299. function ListView_RedrawItems(hwndLV: HWND; iFirst, iLast: Integer): Bool;
  3300. begin
  3301.   Result := Bool( SendMessage(hwndLV, LVM_REDRAWITEMS, iFirst, iLast) );
  3302. end;
  3303.  
  3304. function ListView_Arrange(hwndLV: HWND; Code: UINT): Bool;
  3305. begin
  3306.   Result := Bool( SendMessage(hwndLV, LVM_ARRANGE, Code, 0) );
  3307. end;
  3308.  
  3309. function ListView_EditLabelA(hwndLV: HWND; i: Integer): HWND;
  3310. begin
  3311.   Result := HWND( SendMessage(hwndLV, LVM_EDITLABEL, i, 0) );
  3312. end;
  3313. function ListView_EditLabelW(hwndLV: HWND; i: Integer): HWND;
  3314. begin
  3315.   Result := HWND( SendMessage(hwndLV, LVM_EDITLABEL, i, 0) );
  3316. end;
  3317. function ListView_EditLabel(hwndLV: HWND; i: Integer): HWND;
  3318. begin
  3319.   Result := HWND( SendMessage(hwndLV, LVM_EDITLABEL, i, 0) );
  3320. end;
  3321.  
  3322. function ListView_GetEditControl(hwndLV: HWND): HWND;
  3323. begin
  3324.   Result := HWND( SendMessage(hwndLV, LVM_GETEDITCONTROL, 0, 0) );
  3325. end;
  3326.  
  3327. function ListView_GetColumnA(hwnd: HWND; iCol: Integer; var pcol: TLVColumnA): Bool;
  3328. begin
  3329.   Result := Bool( SendMessage(hwnd, LVM_GETCOLUMN, iCol, Longint(@pcol)) );
  3330. end;
  3331. function ListView_GetColumnW(hwnd: HWND; iCol: Integer; var pcol: TLVColumnW): Bool;
  3332. begin
  3333.   Result := Bool( SendMessage(hwnd, LVM_GETCOLUMN, iCol, Longint(@pcol)) );
  3334. end;
  3335. function ListView_GetColumn(hwnd: HWND; iCol: Integer; var pcol: TLVColumn): Bool;
  3336. begin
  3337.   Result := Bool( SendMessage(hwnd, LVM_GETCOLUMN, iCol, Longint(@pcol)) );
  3338. end;
  3339.  
  3340. function ListView_SetColumnA(hwnd: HWND; iCol: Integer; const pcol: TLVColumnA): Bool;
  3341. begin
  3342.   Result := Bool( SendMessage(hwnd, LVM_SETCOLUMN, iCol, Longint(@pcol)) );
  3343. end;
  3344. function ListView_SetColumnW(hwnd: HWND; iCol: Integer; const pcol: TLVColumnW): Bool;
  3345. begin
  3346.   Result := Bool( SendMessage(hwnd, LVM_SETCOLUMN, iCol, Longint(@pcol)) );
  3347. end;
  3348. function ListView_SetColumn(hwnd: HWND; iCol: Integer; const pcol: TLVColumn): Bool;
  3349. begin
  3350.   Result := Bool( SendMessage(hwnd, LVM_SETCOLUMN, iCol, Longint(@pcol)) );
  3351. end;
  3352.  
  3353. function ListView_InsertColumnA(hwnd: HWND; iCol: Integer; const pcol: TLVColumnA): Integer;
  3354. begin
  3355.   Result := SendMessage(hWnd, LVM_INSERTCOLUMN, iCol, Longint(@pcol));
  3356. end;
  3357. function ListView_InsertColumnW(hwnd: HWND; iCol: Integer; const pcol: TLVColumnW): Integer;
  3358. begin
  3359.   Result := SendMessage(hWnd, LVM_INSERTCOLUMN, iCol, Longint(@pcol));
  3360. end;
  3361. function ListView_InsertColumn(hwnd: HWND; iCol: Integer; const pcol: TLVColumn): Integer;
  3362. begin
  3363.   Result := SendMessage(hWnd, LVM_INSERTCOLUMN, iCol, Longint(@pcol));
  3364. end;
  3365.  
  3366. function ListView_DeleteColumn(hwnd: HWND; iCol: Integer): Bool;
  3367. begin
  3368.   Result := Bool( SendMessage(hWnd, LVM_DELETECOLUMN, iCol, 0) );
  3369. end;
  3370.  
  3371. function ListView_GetColumnWidth(hwnd: HWND; iCol: Integer): Integer;
  3372. begin
  3373.   Result := Integer( SendMessage(hwnd, LVM_GETCOLUMNWIDTH, iCol, 0) );
  3374. end;
  3375.  
  3376. function ListView_SetColumnWidth(hwnd: HWnd; iCol: Integer; cx: Integer): Bool;
  3377. begin
  3378.   Result := Bool( SendMessage(hwnd, LVM_SETCOLUMNWIDTH, iCol,
  3379.     MakeLong((cx), 0)) );
  3380. end;
  3381.  
  3382. function ListView_CreateDragImage(hwnd: HWND; i: Integer;
  3383.   const lpptUpLeft: TPoint): HImageList;
  3384. begin
  3385.   Result := HIMAGELIST( SendMessage(hwnd, LVM_CREATEDRAGIMAGE, i,
  3386.     Longint(@lpptUpLeft)));
  3387. end;
  3388.  
  3389. function ListView_GetViewRect(hwnd: HWND; var prc: TRect): Bool;
  3390. begin
  3391.   Result := Bool( SendMessage(hwnd, LVM_GETVIEWRECT, 0, Longint(@prc)) );
  3392. end;
  3393.  
  3394. function ListView_GetTextColor(hwnd: HWND): TColorRef;
  3395. begin
  3396.   Result := SendMessage(hwnd, LVM_GETTEXTCOLOR, 0, 0);
  3397. end;
  3398.  
  3399. function ListView_SetTextColor(hwnd: HWND; clrText: TColorRef): Bool;
  3400. begin
  3401.   Result := Bool( SendMessage(hwnd, LVM_SETTEXTCOLOR, 0, clrText) );
  3402. end;
  3403.  
  3404. function ListView_GetTextBkColor(hwnd: HWND): TColorRef;
  3405. begin
  3406.   Result := SendMessage(hwnd, LVM_GETTEXTBKCOLOR, 0, 0);
  3407. end;
  3408.  
  3409. function ListView_SetTextBkColor(hwnd: HWND; clrTextBk: TColorRef): Bool;
  3410. begin
  3411.   Result := Bool( SendMessage(hwnd, LVM_SETTEXTBKCOLOR, 0, clrTextBk) );
  3412. end;
  3413.  
  3414. function ListView_GetTopIndex(hwndLV: HWND): Integer;
  3415. begin
  3416.   Result := SendMessage(hwndLV, LVM_GETTOPINDEX, 0, 0);
  3417. end;
  3418.  
  3419. function ListView_GetCountPerPage(hwndLV: HWND): Integer;
  3420. begin
  3421.   Result := SendMessage(hwndLV, LVM_GETCOUNTPERPAGE, 0, 0);
  3422. end;
  3423.  
  3424. function ListView_GetOrigin(hwndLV: HWND; var ppt: TPoint): Bool;
  3425. begin
  3426.   Result := Bool( SendMessage(hwndLV, LVM_GETORIGIN, 0, Longint(@ppt)) );
  3427. end;
  3428.  
  3429. function ListView_Update(hwndLV: HWND; i: Integer): Bool;
  3430. begin
  3431.   Result := SendMessage(hwndLV, LVM_UPDATE, i, 0) <> 0;
  3432. end;
  3433.  
  3434. function ListView_SetItemState(hwndLV: HWND; i: Integer; data, mask: UINT): Bool;
  3435. var
  3436.   Item: TLVItem;
  3437. begin
  3438.   Item.stateMask := mask;
  3439.   Item.state := data;
  3440.   Result := Bool( SendMessage(hwndLV, LVM_SETITEMSTATE, i, Longint(@Item)) );
  3441. end;
  3442.  
  3443. function ListView_GetItemState(hwndLV: HWND; i, mask: Integer): Integer;
  3444. begin
  3445.   Result := SendMessage(hwndLV, LVM_GETITEMSTATE, i, mask);
  3446. end;
  3447.  
  3448. function ListView_GetCheckState(hwndLV: HWND; i: Integer): UINT;
  3449. begin
  3450.   Result := (SendMessage(hwndLV, LVM_GETITEMSTATE, i, LVIS_STATEIMAGEMASK) shr 12) - 1 ;
  3451. end;
  3452.  
  3453. procedure ListView_SetCheckState(hwndLV: HWND; i: Integer; Checked: Boolean);
  3454. var
  3455.   Item: TLVItem;
  3456. begin
  3457.   Item.statemask := LVIS_STATEIMAGEMASK;
  3458.   Item.State := ((Integer(Checked) and 1) + 1) shl 12;
  3459.   SendMessage(hwndLV, LVM_SETITEMSTATE, i, Integer(@Item));
  3460. end;
  3461.  
  3462. function ListView_GetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  3463.   pszText: PAnsiChar; cchTextMax: Integer): Integer;
  3464. var
  3465.   Item: TLVItemA;
  3466. begin
  3467.   Item.iSubItem := iSubItem;
  3468.   Item.cchTextMax := cchTextMax;
  3469.   Item.pszText := pszText;
  3470.   Result := SendMessage(hwndLV, LVM_GETITEMTEXT, i, Longint(@Item));
  3471. end;
  3472. function ListView_GetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  3473.   pszText: PWideChar; cchTextMax: Integer): Integer;
  3474. var
  3475.   Item: TLVItemW;
  3476. begin
  3477.   Item.iSubItem := iSubItem;
  3478.   Item.cchTextMax := cchTextMax;
  3479.   Item.pszText := pszText;
  3480.   Result := SendMessage(hwndLV, LVM_GETITEMTEXT, i, Longint(@Item));
  3481. end;
  3482. function ListView_GetItemText(hwndLV: HWND; i, iSubItem: Integer;
  3483.   pszText: PChar; cchTextMax: Integer): Integer;
  3484. var
  3485.   Item: TLVItem;
  3486. begin
  3487.   Item.iSubItem := iSubItem;
  3488.   Item.cchTextMax := cchTextMax;
  3489.   Item.pszText := pszText;
  3490.   Result := SendMessage(hwndLV, LVM_GETITEMTEXT, i, Longint(@Item));
  3491. end;
  3492.  
  3493. function ListView_SetItemTextA(hwndLV: HWND; i, iSubItem: Integer;
  3494.   pszText: PAnsiChar): Bool;
  3495. var
  3496.   Item: TLVItemA;
  3497. begin
  3498.   Item.iSubItem := iSubItem;
  3499.   Item.pszText := pszText;
  3500.   Result := Bool( SendMessage(hwndLV, LVM_SETITEMTEXT, i, Longint(@Item)) );
  3501. end;
  3502. function ListView_SetItemTextW(hwndLV: HWND; i, iSubItem: Integer;
  3503.   pszText: PWideChar): Bool;
  3504. var
  3505.   Item: TLVItemW;
  3506. begin
  3507.   Item.iSubItem := iSubItem;
  3508.   Item.pszText := pszText;
  3509.   Result := Bool( SendMessage(hwndLV, LVM_SETITEMTEXT, i, Longint(@Item)) );
  3510. end;
  3511. function ListView_SetItemText(hwndLV: HWND; i, iSubItem: Integer;
  3512.   pszText: PChar): Bool;
  3513. var
  3514.   Item: TLVItem;
  3515. begin
  3516.   Item.iSubItem := iSubItem;
  3517.   Item.pszText := pszText;
  3518.   Result := Bool( SendMessage(hwndLV, LVM_SETITEMTEXT, i, Longint(@Item)) );
  3519. end;
  3520.  
  3521. procedure ListView_SetItemCount(hwndLV: HWND; cItems: Integer);
  3522. begin
  3523.   SendMessage(hwndLV, LVM_SETITEMCOUNT, cItems, 0);
  3524. end;
  3525.  
  3526. function ListView_SortItems(hwndLV: HWND; pfnCompare: TLVCompare;
  3527.   lPrm: Longint): Bool;
  3528. begin
  3529.   Result := Bool( SendMessage(hwndLV, LVM_SORTITEMS, lPrm,
  3530.     Longint(@pfnCompare)) );
  3531. end;
  3532.  
  3533. procedure ListView_SetItemPosition32(hwndLV: HWND; i, x, y: Integer);
  3534. var
  3535.   ptNewPos: TPoint;
  3536. begin
  3537.   ptNewPos.x := x;
  3538.   ptNewPos.y := y;
  3539.   SendMessage(hwndLV, LVM_SETITEMPOSITION32, i, Longint(@ptNewPos));
  3540. end;
  3541.  
  3542. function ListView_GetSelectedCount(hwndLV: HWND): UINT;
  3543. begin
  3544.   Result := SendMessage(hwndLV, LVM_GETSELECTEDCOUNT, 0, 0);
  3545. end;
  3546.  
  3547. function ListView_GetItemSpacing(hwndLV: HWND; fSmall: Integer): Longint;
  3548. begin
  3549.   Result := SendMessage(hwndLV, LVM_GETITEMSPACING, fSmall, 0);
  3550. end;
  3551.  
  3552. function ListView_GetISearchStringA(hwndLV: HWND; lpsz: PAnsiChar): Bool;
  3553. begin
  3554.   Result := Bool( SendMessage(hwndLV, LVM_GETISEARCHSTRING, 0,
  3555.     Longint(lpsz)) );
  3556. end;
  3557. function ListView_GetISearchStringW(hwndLV: HWND; lpsz: PWideChar): Bool;
  3558. begin
  3559.   Result := Bool( SendMessage(hwndLV, LVM_GETISEARCHSTRING, 0,
  3560.     Longint(lpsz)) );
  3561. end;
  3562. function ListView_GetISearchString(hwndLV: HWND; lpsz: PChar): Bool;
  3563. begin
  3564.   Result := Bool( SendMessage(hwndLV, LVM_GETISEARCHSTRING, 0,
  3565.     Longint(lpsz)) );
  3566. end;
  3567.  
  3568. function ListView_SetIconSpacing(hwndLV: HWND; cx, cy: Word): DWORD;
  3569. begin
  3570.   Result := SendMessage(hwndLV, LVM_SETICONSPACING, 0, MakeLong(cx, cy));
  3571. end;
  3572.  
  3573. function ListView_SetExtendedListViewStyle(hwndLV: HWND; dw: DWORD): BOOL;
  3574. begin
  3575.   Result := BOOL(SendMessage(hwndLV, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dw));
  3576. end;
  3577.  
  3578. function ListView_GetExtendedListViewStyle(hwndLV: HWND): DWORD;
  3579. begin
  3580.   Result := SendMessage(hwndLV, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
  3581. end;
  3582.  
  3583. function ListView_GetSubItemRect(hwndLV: HWND; iItem, iSubItem: Integer;
  3584.   code: DWORD; prc: PRect): BOOL;
  3585. begin
  3586.   if prc <> nil then
  3587.   begin
  3588.     prc^.Top := iSubItem;
  3589.     prc^.Left := code;
  3590.   end;
  3591.   Result := BOOL(SendMessage(hwndLV, LVM_GETSUBITEMRECT, iItem, Longint(prc)));
  3592. end;
  3593.  
  3594. function ListView_SubItemHitTest(hwndLV: HWND; plvhti: PLVHitTestInfo): Integer;
  3595. begin
  3596.   Result := SendMessage(hwndLV, LVM_SUBITEMHITTEST, 0, Longint(plvhti));
  3597. end;
  3598.  
  3599. function ListView_SetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  3600.   pi: PInteger): BOOL;
  3601. begin
  3602.   Result := BOOL(SendMessage(hwndLV, LVM_SETCOLUMNORDERARRAY, iCount,
  3603.     Longint(pi)));
  3604. end;
  3605.  
  3606. function ListView_GetColumnOrderArray(hwndLV: HWND; iCount: Integer;
  3607.   pi: PInteger): BOOL;
  3608. begin
  3609.   Result := BOOL(SendMessage(hwndLV, LVM_GETCOLUMNORDERARRAY, iCount,
  3610.     Longint(pi)));
  3611. end;
  3612.  
  3613. function ListView_SetHotItem(hwndLV: HWND; i: Integer): Integer;
  3614. begin
  3615.   Result := SendMessage(hwndLV, LVM_SETHOTITEM, i, 0);
  3616. end;
  3617.  
  3618. function ListView_GetHotItem(hwndLV: HWND): Integer;
  3619. begin
  3620.   Result := SendMessage(hwndLV, LVM_GETHOTITEM, 0, 0);
  3621. end;
  3622.  
  3623. function ListView_SetHotCursor(hwndLV: HWND; hcur: HCURSOR): HCURSOR;
  3624. begin
  3625.   Result := SendMessage(hwndLV, LVM_SETHOTCURSOR, 0, hcur);
  3626. end;
  3627.  
  3628. function ListView_GetHotCursor(hwndLV: HWND): HCURSOR;
  3629. begin
  3630.   Result := SendMessage(hwndLV, LVM_GETHOTCURSOR, 0, 0);
  3631. end;
  3632.  
  3633. function ListView_ApproximateViewRect(hwndLV: HWND; iWidth, iHeight: Word;
  3634.   iCount: Integer): DWORD;
  3635. begin
  3636.   Result := SendMessage(hwndLV, LVM_APPROXIMATEVIEWRECT, iCount,
  3637.     MakeLParam(iWidth, iHeight));
  3638. end;
  3639.  
  3640. function ListView_SetWorkArea(hwndLV: HWND; prc: PRect): BOOL;
  3641. begin
  3642.   Result := BOOL(SendMessage(hwndLV, LVM_SETWORKAREA, 0, Longint(prc)));
  3643. end;
  3644.  
  3645. { Tree View }
  3646.  
  3647. function TreeView_InsertItem(hwnd: HWND; const lpis: TTVInsertStruct): HTreeItem;
  3648. begin
  3649.   Result := HTreeItem( SendMessage(hwnd, TVM_INSERTITEM, 0, Longint(@lpis)) );
  3650. end;
  3651.  
  3652. function TreeView_DeleteItem(hwnd: HWND; hitem: HTreeItem): Bool;
  3653. begin
  3654.   Result := Bool( SendMessage(hwnd, TVM_DELETEITEM, 0, Longint(hitem)) );
  3655. end;
  3656.  
  3657. function TreeView_DeleteAllItems(hwnd: HWND): Bool;
  3658. begin
  3659.   Result := Bool( SendMessage(hwnd, TVM_DELETEITEM, 0, Longint(TVI_ROOT)) );
  3660. end;
  3661.  
  3662. function TreeView_Expand(hwnd: HWND; hitem: HTreeItem; code: Integer): Bool;
  3663. begin
  3664.   Result := Bool( SendMessage(hwnd, TVM_EXPAND, code, Longint(hitem)) );
  3665. end;
  3666.  
  3667. function TreeView_GetItemRect(hwnd: HWND; hitem: HTreeItem;
  3668.   var prc: TRect; code: Bool): Bool;
  3669. begin
  3670.   HTreeItem(Pointer(@prc)^) := hitem;
  3671.   Result := Bool( SendMessage(hwnd, TVM_GETITEMRECT, Integer(code), Longint(@prc)) );
  3672. end;
  3673.  
  3674. function TreeView_GetCount(hwnd: HWND): UINT;
  3675. begin
  3676.   Result := SendMessage(hwnd, TVM_GETCOUNT, 0, 0);
  3677. end;
  3678.  
  3679. function TreeView_GetIndent(hwnd: HWND): UINT;
  3680. begin
  3681.   Result := SendMessage(hwnd, TVM_GETINDENT, 0, 0);
  3682. end;
  3683.  
  3684. function TreeView_SetIndent(hwnd: HWND; indent: Integer): Bool;
  3685. begin
  3686.   Result := Bool( SendMessage(hwnd, TVM_SETINDENT, indent, 0) );
  3687. end;
  3688.  
  3689. function TreeView_GetImageList(hwnd: HWND; iImage: Integer): HImageList;
  3690. begin
  3691.   Result := HImageList( SendMessage(hwnd, TVM_GETIMAGELIST, iImage, 0) );
  3692. end;
  3693.  
  3694. function TreeView_SetImageList(hwnd: HWND; himl: HImageList;
  3695.   iImage: Integer): HImageList;
  3696. begin
  3697.   Result := HImageList( SendMessage(hwnd, TVM_SETIMAGELIST, iImage,
  3698.     Longint(himl)) );
  3699. end;
  3700.  
  3701. function TreeView_GetNextItem(hwnd: HWND; hitem: HTreeItem;
  3702.   code: Integer): HTreeItem;
  3703. begin
  3704.   Result := HTreeItem( SendMessage(hwnd, TVM_GETNEXTITEM, code,
  3705.     Longint(hitem)) );
  3706. end;
  3707.  
  3708. function TreeView_GetChild(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3709. begin
  3710.   Result := TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD);
  3711. end;
  3712.  
  3713. function TreeView_GetNextSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3714. begin
  3715.   Result := TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT);
  3716. end;
  3717.  
  3718. function TreeView_GetPrevSibling(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3719. begin
  3720.   Result := TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS);
  3721. end;
  3722.  
  3723. function TreeView_GetParent(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3724. begin
  3725.   Result := TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT);
  3726. end;
  3727.  
  3728. function TreeView_GetFirstVisible(hwnd: HWND): HTreeItem;
  3729. begin
  3730.   Result := TreeView_GetNextItem(hwnd, nil,  TVGN_FIRSTVISIBLE);
  3731. end;
  3732.  
  3733. function TreeView_GetNextVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3734. begin
  3735.   Result := TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE);
  3736. end;
  3737.  
  3738. function TreeView_GetPrevVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3739. begin
  3740.   Result := TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE);
  3741. end;
  3742.  
  3743. function TreeView_GetSelection(hwnd: HWND): HTreeItem;
  3744. begin
  3745.   Result := TreeView_GetNextItem(hwnd, nil, TVGN_CARET);
  3746. end;
  3747.  
  3748. function TreeView_GetDropHilite(hwnd: HWND): HTreeItem;
  3749. begin
  3750.   Result := TreeView_GetNextItem(hwnd, nil, TVGN_DROPHILITE);
  3751. end;
  3752.  
  3753. function TreeView_GetRoot(hwnd: HWND): HTreeItem;
  3754. begin
  3755.   Result := TreeView_GetNextItem(hwnd, nil, TVGN_ROOT);
  3756. end;
  3757.  
  3758. function TreeView_Select(hwnd: HWND; hitem: HTreeItem;
  3759.   code: Integer): HTreeItem;
  3760. begin
  3761.   Result := HTreeItem( SendMessage(hwnd, TVM_SELECTITEM, code,
  3762.     Longint(hitem)) );
  3763. end;
  3764.  
  3765. function TreeView_SelectItem(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3766. begin
  3767.   Result := TreeView_Select(hwnd, hitem, TVGN_CARET);
  3768. end;
  3769.  
  3770. function TreeView_SelectDropTarget(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3771. begin
  3772.   Result := TreeView_Select(hwnd, hitem, TVGN_DROPHILITE);
  3773. end;
  3774.  
  3775. function TreeView_SelectSetFirstVisible(hwnd: HWND; hitem: HTreeItem): HTreeItem;
  3776. begin
  3777.   Result := TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE);
  3778. end;
  3779.  
  3780. function TreeView_GetItemA(hwnd: HWND; var pitem: TTVItemA): Bool;
  3781. begin
  3782.   Result := Bool( SendMessage(hwnd, TVM_GETITEM, 0, Longint(@pitem)) );
  3783. end;
  3784. function TreeView_GetItemW(hwnd: HWND; var pitem: TTVItemW): Bool;
  3785. begin
  3786.   Result := Bool( SendMessage(hwnd, TVM_GETITEM, 0, Longint(@pitem)) );
  3787. end;
  3788. function TreeView_GetItem(hwnd: HWND; var pitem: TTVItem): Bool;
  3789. begin
  3790.   Result := Bool( SendMessage(hwnd, TVM_GETITEM, 0, Longint(@pitem)) );
  3791. end;
  3792.  
  3793. function TreeView_SetItemA(hwnd: HWND; const pitem: TTVItemA): Bool;
  3794. begin
  3795.   Result := Bool( SendMessage(hwnd, TVM_SETITEM, 0, Longint(@pitem)) );
  3796. end;
  3797. function TreeView_SetItemW(hwnd: HWND; const pitem: TTVItemW): Bool;
  3798. begin
  3799.   Result := Bool( SendMessage(hwnd, TVM_SETITEM, 0, Longint(@pitem)) );
  3800. end;
  3801. function TreeView_SetItem(hwnd: HWND; const pitem: TTVItem): Bool;
  3802. begin
  3803.   Result := Bool( SendMessage(hwnd, TVM_SETITEM, 0, Longint(@pitem)) );
  3804. end;
  3805.  
  3806. function TreeView_EditLabelA(hwnd: HWND; hitem: HTreeItem): HWND;
  3807. begin
  3808.   Result := Windows.HWND( SendMessage(hwnd, TVM_EDITLABEL, 0, Longint(hitem)) );
  3809. end;
  3810. function TreeView_EditLabelW(hwnd: HWND; hitem: HTreeItem): HWND;
  3811. begin
  3812.   Result := Windows.HWND( SendMessage(hwnd, TVM_EDITLABEL, 0, Longint(hitem)) );
  3813. end;
  3814. function TreeView_EditLabel(hwnd: HWND; hitem: HTreeItem): HWND;
  3815. begin
  3816.   Result := Windows.HWND( SendMessage(hwnd, TVM_EDITLABEL, 0, Longint(hitem)) );
  3817. end;
  3818.  
  3819. function TreeView_GetEditControl(hwnd: HWND): HWND;
  3820. begin
  3821.   Result := Windows.HWND( SendMessage(hwnd, TVM_GETEDITCONTROL, 0, 0) );
  3822. end;
  3823.  
  3824. function TreeView_GetVisibleCount(hwnd: HWND): UINT;
  3825. begin
  3826.   Result := SendMessage(hwnd, TVM_GETVISIBLECOUNT, 0, 0);
  3827. end;
  3828.  
  3829. function TreeView_HitTest(hwnd: HWND; var lpht: TTVHitTestInfo): HTreeItem;
  3830. begin
  3831.   Result := HTreeItem( SendMessage(hwnd, TVM_HITTEST, 0, Longint(@lpht)) );
  3832. end;
  3833.  
  3834. function TreeView_CreateDragImage(hwnd: HWND; hitem: HTreeItem): HimageList;
  3835. begin
  3836.   Result := HImageList( SendMessage(hwnd, TVM_CREATEDRAGIMAGE, 0,
  3837.     Longint(hitem)) );
  3838. end;
  3839.  
  3840. function TreeView_SortChildren(hwnd: HWND; hitem: HTreeItem;
  3841.   recurse: Integer): Bool;
  3842. begin
  3843.   Result := Bool( SendMessage(hwnd, TVM_SORTCHILDREN, recurse,
  3844.     Longint(hitem)) );
  3845. end;
  3846.  
  3847. function TreeView_EnsureVisible(hwnd: HWND; hitem: HTreeItem): Bool;
  3848. begin
  3849.   Result := Bool( SendMessage(hwnd, TVM_ENSUREVISIBLE, 0, Longint(hitem)) );
  3850. end;
  3851.  
  3852. function TreeView_SortChildrenCB(hwnd: HWND; const psort: TTVSortCB;
  3853.   recurse: Integer): Bool;
  3854. begin
  3855.   Result := Bool( SendMessage(hwnd, TVM_SORTCHILDRENCB, recurse,
  3856.     Longint(@psort)) );
  3857. end;
  3858.  
  3859. function TreeView_EndEditLabelNow(hwnd: HWND; fCancel: Bool): Bool;
  3860. begin
  3861.   Result := Bool( SendMessage(hwnd, TVM_ENDEDITLABELNOW, Integer(fCancel),
  3862.     0) );
  3863. end;
  3864.  
  3865. function TreeView_GetISearchStringA(hwndTV: HWND; lpsz: PAnsiChar): Bool;
  3866. begin
  3867.   Result := Bool( SendMessage(hwndTV, TVM_GETISEARCHSTRING, 0,
  3868.     Longint(lpsz)) );
  3869. end;
  3870. function TreeView_GetISearchStringW(hwndTV: HWND; lpsz: PWideChar): Bool;
  3871. begin
  3872.   Result := Bool( SendMessage(hwndTV, TVM_GETISEARCHSTRING, 0,
  3873.     Longint(lpsz)) );
  3874. end;
  3875. function TreeView_GetISearchString(hwndTV: HWND; lpsz: PChar): Bool;
  3876. begin
  3877.   Result := Bool( SendMessage(hwndTV, TVM_GETISEARCHSTRING, 0,
  3878.     Longint(lpsz)) );
  3879. end;
  3880.  
  3881. { MonthCal control }
  3882.  
  3883. function MonthCal_GetCurSel(hmc: HWND; var pst: TSystemTime): BOOL;
  3884. begin
  3885.   Result := BOOL(SendMessage(hmc, MCM_GETCURSEL, 0, Longint(@pst)));
  3886. end;
  3887.  
  3888. function MonthCal_SetCurSel(hmc: HWND; const pst: TSystemTime): BOOL;
  3889. begin
  3890.   Result := BOOL(SendMessage(hmc, MCM_SETCURSEL, 0, Longint(@pst)));
  3891. end;
  3892.  
  3893. function MonthCal_GetMaxSelCount(hmc: HWND): DWORD;
  3894. begin
  3895.   Result := SendMessage(hmc, MCM_GETMAXSELCOUNT, 0, 0);
  3896. end;
  3897.  
  3898. function MonthCal_SetMaxSelCount(hmc: HWND; n: UINT): BOOL;
  3899. begin
  3900.   Result := BOOL(SendMessage(hmc, MCM_SETMAXSELCOUNT, n, 0));
  3901. end;
  3902.  
  3903. function MonthCal_GetSelRange(hmc: HWND; rgst: PSystemTime): BOOL;
  3904. begin
  3905.   Result := BOOL(SendMessage(hmc, MCM_GETSELRANGE, 0, Longint(rgst)));
  3906. end;
  3907.  
  3908. function MonthCal_SetSelRange(hmc: HWND; rgst: PSystemTime): BOOL;
  3909. begin
  3910.   Result := BOOL(SendMessage(hmc, MCM_SETSELRANGE, 0, Longint(rgst)));
  3911. end;
  3912.  
  3913. function MonthCal_GetMonthRange(hmc: HWND; gmr: DWORD; rgst: PSystemTime): DWORD;
  3914. begin
  3915.   Result := SendMessage(hmc, MCM_GETMONTHRANGE, gmr, Longint(rgst));
  3916. end;
  3917.  
  3918. function MonthCal_SetDayState(hmc: HWND; cbds: Integer; const rgds: TNMDayState): BOOL;
  3919. begin
  3920.   Result := BOOL(SendMessage(hmc, MCM_SETDAYSTATE, cbds, Longint(@rgds)));
  3921. end;
  3922.  
  3923. function MonthCal_GetMinReqRect(hmc: HWND; var prc: TRect): BOOL;
  3924. begin
  3925.   Result := BOOL(SendMessage(hmc, MCM_GETMINREQRECT, 0, Longint(@prc)));
  3926. end;
  3927.  
  3928. function MonthCal_SetToday(hmc: HWND; const pst: TSystemTime): BOOL;
  3929. begin
  3930.   Result := BOOL(SendMessage(hmc, MCM_SETTODAY, 0, Longint(@pst)));
  3931. end;
  3932.  
  3933. function MonthCal_GetToday(hmc: HWND; var pst: TSystemTime): BOOL;
  3934. begin
  3935.   Result := BOOL(SendMessage(hmc, MCM_GETTODAY, 0, Longint(@pst)));
  3936. end;
  3937.  
  3938. function MonthCal_HitTest(hmc: HWND; var info: TMCHitTestInfo): DWORD;
  3939. begin
  3940.   Result := SendMessage(hmc, MCM_HITTEST, 0, Longint(@info));
  3941. end;
  3942.  
  3943. function MonthCal_SetColor(hmc: HWND; iColor: Integer; clr: TColorRef): BOOL;
  3944. begin
  3945.   Result := BOOL(SendMessage(hmc, MCM_SETCOLOR, iColor, clr));
  3946. end;
  3947.  
  3948. function MonthCal_GetColor(hmc: HWND; iColor: Integer): TColorRef;
  3949. begin
  3950.   Result := TColorRef(SendMessage(hmc, MCM_SETCOLOR, iColor, 0));
  3951. end;
  3952.  
  3953. function MonthCal_SetFirstDayOfWeek(hmc: HWND; iDay: Integer): BOOL;
  3954. begin
  3955.   Result := BOOL(SendMessage(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay));
  3956. end;
  3957.  
  3958. function MonthCal_GetFirstDayOfWeek(hmc: HWND): Integer;
  3959. begin
  3960.   Result := SendMessage(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0);
  3961. end;
  3962.  
  3963. function MonthCal_GetRange(hmc: HWND; rgst: PSystemTime): DWORD;
  3964. begin
  3965.   Result := SendMessage(hmc, MCM_GETRANGE, 0, Longint(rgst));
  3966. end;
  3967.  
  3968. function Monthcal_SetRange(hmc: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL;
  3969. begin
  3970.   Result := BOOL(SendMessage(hmc, MCM_SETRANGE, gdtr, Longint(rgst)));
  3971. end;
  3972.  
  3973. function MonthCal_GetMonthDelta(hmc: HWND): Integer;
  3974. begin
  3975.   Result := SendMessage(hmc, MCM_GETMONTHDELTA, 0, 0);
  3976. end;
  3977.  
  3978. function MonthCal_SetMonthDelta(hmc: HWND; n: Integer): Integer;
  3979. begin
  3980.   Result := SendMessage(hmc, MCM_SETMONTHDELTA, n, 0);
  3981. end;
  3982.  
  3983. { Date/Time Picker }
  3984.  
  3985. function DateTime_GetSystemTime(hdp: HWND; var pst: TSystemTime): DWORD;
  3986. begin
  3987.   Result := SendMessage(hdp, DTM_GETSYSTEMTIME, 0, Longint(@pst));
  3988. end;
  3989.  
  3990. function DateTime_SetSystemTime(hdp: HWND; gd: DWORD; const pst: TSystemTime): BOOL;
  3991. begin
  3992.   Result := BOOL(SendMessage(hdp, DTM_SETSYSTEMTIME, gd, Longint(@pst)));
  3993. end;
  3994.  
  3995. function DateTime_GetRange(hdp: HWND; rgst: PSystemTime): DWORD;
  3996. begin
  3997.   Result := SendMessage(hdp, DTM_GETRANGE, 0, Longint(rgst));
  3998. end;
  3999.  
  4000. function DateTime_SetRange(hdp: HWND; gdtr: DWORD; rgst: PSystemTime): BOOL;
  4001. begin
  4002.   Result := BOOL(SendMessage(hdp, DTM_SETRANGE, gdtr, Longint(rgst)));
  4003. end;
  4004.  
  4005. function DateTime_SetFormatA(hdp: HWND; sz: PAnsiChar): BOOL;
  4006. begin
  4007.   Result := BOOL(SendMessage(hdp, DTM_SETFORMATA, 0, Longint(sz)));
  4008. end;
  4009. function DateTime_SetFormatW(hdp: HWND; sz: PWideChar): BOOL;
  4010. begin
  4011.   Result := BOOL(SendMessage(hdp, DTM_SETFORMATW, 0, Longint(sz)));
  4012. end;
  4013. function DateTime_SetFormat(hdp: HWND; sz: PChar): BOOL;
  4014. begin
  4015.   Result := BOOL(SendMessage(hdp, DTM_SETFORMAT, 0, Longint(sz)));
  4016. end;
  4017.  
  4018. function DateTime_SetMonthCalColor(hdp: HWND; iColor: DWORD; clr: TColorRef): DWORD;
  4019. begin
  4020.   Result := SendMessage(hdp, DTM_SETMCCOLOR, iColor, clr);
  4021. end;
  4022.  
  4023. function DateTime_GetMonthCalColor(hdp: HWND; iColor: DWORD): TColorRef;
  4024. begin
  4025.   Result := SendMessage(hdp, DTM_GETMCCOLOR, iColor, 0);
  4026. end;
  4027.  
  4028. function DateTime_GetMonthCal(hdp: HWND): HWND;
  4029. begin
  4030.   Result := SendMessage(hdp, DTM_GETMONTHCAL, 0, 0);
  4031. end;
  4032.  
  4033. function DateTime_SetMonthCalFont(hdp: HWND; Font: HFONT; fRedraw: Boolean): DWORD;
  4034. begin
  4035.   Result := SendMessage(hdp, DTM_SETMCFONT, Font, Ord(fRedraw));
  4036. end;
  4037.  
  4038. function DateTime_GetMonthCalFont(hdp: HWND): HFONT;
  4039. begin
  4040.   Result := SendMessage(hdp, DTM_GETMCFONT, 0, 0);
  4041. end;
  4042.  
  4043. end.
  4044.